Code by Scott שאול בן ישוע
README.md 1.21 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
20
21
22
23
24
25
26
27
28

Simply

```bash
mvn clean install
```

# Install on Pi to Start at Boot Up

```bash
sudo nano /etc/rc.local
```

Scott Grayban's avatar
edits    
Scott Grayban committed
29
Then add the line _BEFORE_ ```exit 0```
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
30
31

```bash
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
32
java -jar /root/raspberrypi.monitor/target/raspberrypi.janipi-0.0.1-SNAPSHOT.jar &
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
33
34
35
36
37
```

# Usage

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

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
}
```