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

This is a very lean little project based on SpringBoot 2.0M7 and [Pi4J](http://pi4j.com).

# Pre-requisites

Scott Grayban's avatar
edits    
Scott Grayban committed
7
8
* [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
9

Scott Grayban's avatar
edits    
Scott Grayban committed
10
11
12
13
14
# 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
15
# Build as root
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
16
17
18
19

Simply

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

Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
22
23
24
mvn clean install
```

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

Sha'ul ben Yeshua's avatar
edits    
Sha'ul ben Yeshua committed
27
28
```bash
cp raspberrypi_monitor.service /etc/systemd/system/raspberrypi_monitor.service
29
30
31
systemctl daemon-reload
systemctl enable raspberrypi_monitor.service
systemctl start raspberrypi_monitor.service
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
32
33
```

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

Sha'ul ben Yeshua's avatar
edits    
Sha'ul ben Yeshua committed
36
37
38
```bash
systemctl status raspberrypi_monitor.service
```
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
39
40
41
42

# Usage

```
Scott Grayban's avatar
edits    
Scott Grayban committed
43
http://Rpi-IP:8080/api/pi
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
```

Would yield something like this:

```json
{
"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"
],
"cpuFrequency": 600000000
}
```
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
68