* **UPDATE ***
A new and improved API has been released, check it out!
A simple API for monitoring your raspberry pi.
Clone the repository:
$ git clone email@example.com:raekw0n/raspi-mon-api.git
Create the virtual environment:
$ pip virtualenv piMonitor
Activate the virtual environment:
$ source piMonitor/bin/activate
Install the project’s dependencies:
$ pip install -r requirements.txt
How it Works
It’s incredibly simple, just submit a GET request to your chosen endpoint to receive data, which will always be returned in JSON format, then you can consume that data with whatever library/language you’re using and use it to display information about your Pi.
Returns a JSON object containing core system information, including:
- CPU: temperature, clock speed (frequency) and system-wide usage as a percentage.
- Disk: total size (GB), used amount (GB), remaining space (GB) and usage as a percentage.
- Processes: top ten processes by memory usage, process information includes name, PID, username and memory (MB).
- Platform: distribution name and kernel version.
- Uptime: system uptime represented in format “n days, n hours, n minutes and n seconds”.
Please refer to the
system.json test file for a detailed example.
Returns a JSON object containing network information, including:
- connections: established UNIX socket connections.
- interfaces: network interfaces and send/receive, error and dropout statistics.
- wifi: wireless SSID, host MAC address, channel, encryption, signal strength, and quality as a percentage.
Please refer to the
network.json test file for a detailed example.
Streams a JSON representation of kB/s sent/received for the chosen interface
Firstly, make sure you have
$ sudo apt install libapache2-mod-wsgi
Then create and enable your new virtualhost configuration:
<VirtualHost *:80> ServerName api.raspberrypi.local ServerAlias www.api.raspberrypi.local WSGIScriptAlias / /var/www/flaskapps/rasPiMon/raspimon.wsgi <Directory /var/www/flaskapps/rasPiMon> Options Indexes FollowSymLinks MultiViews AllowOverride all Require all granted </Directory> ErrorLog /var/log/apache2/api.raspberrypi.local-error.log CustomLog /var/log/apache2/api.raspberrypi.local-access.log combined </VirtualHost>
$ sudo a2ensite api.raspberrypi.local.conf $ sudo systemctl reload apache2
A working example client can be downloaded from here.
RaspiMon API is open-sourced software licensed under the MIT license.