Code by Scott שאול בן ישוע
README.md 3.22 KB
Newer Older
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
1
2
# Monitor & Information Rest API for Raspberry PI

Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
3
This is a very lean little project based on [SpringBoot](https://spring.io/projects/spring-boot) 2.0 and [Pi4J](http://pi4j.com).
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
4

5
6
Current version *1.3*

Scott Grayban's avatar
edits    
Scott Grayban committed
7
8
# Projects using this java app

Scott Grayban's avatar
edits    
Scott Grayban committed
9
* Hubitat [Raspberry-Pi-Stats](https://github.com/sgrayban/Hubitat-Ports/tree/master/Drivers/rpi)
Scott Grayban's avatar
edits    
Scott Grayban committed
10

Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
11
12
# Pre-requisites

Scott Grayban's avatar
edits    
Scott Grayban committed
13
14
* [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) - apt install oracle-java8-jdk
* [Maven 3x](https://maven.apache.org/download.cgi) - apt install maven
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
15

Scott Grayban's avatar
edits    
Scott Grayban committed
16
17
18
19
20
# Download
Make sure you are in /root directory first then....

```git clone https://github.com/sgrayban/raspberrypi.monitor.git```

Scott Grayban's avatar
edits    
Scott Grayban committed
21
# Build as root
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
22
23
24
25

Simply

```bash
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
26
27
cd /root/raspberrypi.monitor

Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
28
29
30
mvn clean install
```

31
32
33
# Installation

Install raspberrypi_monitor.service as a Systemd script to start at boot
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
34

Sha'ul ben Yeshua's avatar
edits    
Sha'ul ben Yeshua committed
35
36
```bash
cp raspberrypi_monitor.service /etc/systemd/system/raspberrypi_monitor.service
37
38
39
systemctl daemon-reload
systemctl enable raspberrypi_monitor.service
systemctl start raspberrypi_monitor.service
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
40
41
```

42
Then to make sure the app is running
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
43

Sha'ul ben Yeshua's avatar
edits    
Sha'ul ben Yeshua committed
44
45
46
```bash
systemctl status raspberrypi_monitor.service
```
Scott Grayban's avatar
edits    
Scott Grayban committed
47
48
49
50
51
52
53
54
55
56
57
Should yeld something like this

```bash
# systemctl status raspberrypi_monitor.service
● raspberrypi_monitor.service - Manage raspberrypi monitor service
   Loaded: loaded (/etc/systemd/system/raspberrypi_monitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-04-11 16:53:01 PDT; 2min 22s ago
 Main PID: 316 (java)
   CGroup: /system.slice/raspberrypi_monitor.service
           └─316 /usr/bin/java -jar /root/janipi/target/raspberrypi.janipi-0.0.1-SNAPSHOT.jar
```
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Upgrading to version 1.3

A lot of things have changed since I first posted this project and as such install must change!

First raspberrypi_monitor.service has been changed.

1) Install raspberrypi_monitor.service as a Systemd script to start at boot

```bash
cp raspberrypi_monitor.service /etc/systemd/system/raspberrypi_monitor.service
systemctl daemon-reload
systemctl start raspberrypi_monitor.service
```

Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
73
74
75
# Usage

```
Scott Grayban's avatar
edits    
Scott Grayban committed
76
http://Rpi-IP:8080/api/pi
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
77
78
79
80
81
82
```

Would yield something like this:

```json
{
83
"osName": Linux
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
"cpuTemperature": 52.1,
"serialNumber": "0000000000000000",
"cpuCoreVoltage": 1.2,
"modelName": "ARMv7 Processor rev 4 (v7l)",
"boardType": "RaspberryPi_3B",
"totalMemory": 967700480,
"usedMemory": 221253632,
"freeMemory": 401907712,
"sharedMemory": 14475264,
"javaVersion": "1.8.0_152",
"hostname": "raspberrypi",
"ipAddresses": [
"192.168.1.40",
"172.17.0.1"
],
99
100
101
102
103
104
"nameservers":[
"8.8.8.8"
"192.168.0.36"
"2001:428::1"
"2001:428::2"
]
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
105
106
107
"cpuFrequency": 600000000
}
```
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
108

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# RELEASES
2019-04-15 :: 1.3

* Added Support for Raspberry Pi 3A+
* Added support for Raspberry Pi 3B+
* Added support for Raspberry Pi Zero W
* Added support for Raspberry Pi Compute Module 3+
* Added support for Raspberry Pi Compute Module 3

# Supported Hardware

* Raspberry Pi - A
* Raspberry Pi - B (Revision 1)
* Raspberry Pi - B (Revision 2)
* Raspberry Pi - A+
* Raspberry Pi - B+
* Raspberry Pi - 2B
* Raspberry Pi - 3B
* Raspberry Pi - 3B+
* Raspberry Pi - 3A+
* Raspberry Pi - Zero
* Raspberry Pi - Zero W
* Raspberry Pi - CM1 (Compute Module)
* Raspberry Pi - CM3 (Compute Module)
* Raspberry Pi - CM3+ (Compute Module)