An open API service indexing awesome lists of open source software.

https://github.com/eamonnsullivan/disk-watcher-mqtt

Exercise in using MQTT to periodically report very basic stats about disk storage (used and free).
https://github.com/eamonnsullivan/disk-watcher-mqtt

mqtt python3 raspberry-pi systemd-service

Last synced: about 2 months ago
JSON representation

Exercise in using MQTT to periodically report very basic stats about disk storage (used and free).

Awesome Lists containing this project

README

          

# disk-watcher-mqtt

A very simple example of a service that periodically reports disk usage stats to an MQTT broker. I wrote this because I needed to keep an eye on the amount of free space on several Raspberry Pis around the house. I haven't written in Python in years, so this is unlikely to be a good example of how to do this. I chose the language because it's available on all the Pis, even the Zero. I just needed it to work, not be elegant.

## Installation
```
sudo apt-get update
sudo apt install git python3-pip -y
git clone https://github.com/eamonnsullivan/disk-watcher-mqtt.git
cd disk-watcher-mqtt

# install the requirements
pip3 install -r requirements.txt

# edit the configuration
nano disk-watcher.conf
```
## Configuration

See `disk-watcher.conf`, set your broker, port, etc. You'll also want to set the topic_base (the first part of the topic) and the frequency (in seconds) of reporting.

## Set as a service

Make sure the directories and user specified in `disk-watcher.service` match your set up and then:

```
sudo ln -s /home/pi/disk-watcher-mqtt/disk-watcher.service /etc/systemd/system/
sudo systemctl --system daemon-reload
sudo systemctl enable disk-watcher.service
sudo systemctl start disk-watcher.service
# wait a few seconds
sudo systemctl status disk-watcher.service
```