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).
- Host: GitHub
- URL: https://github.com/eamonnsullivan/disk-watcher-mqtt
- Owner: eamonnsullivan
- License: mit
- Created: 2021-06-26T19:37:39.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-30T17:13:04.000Z (over 1 year ago)
- Last Synced: 2025-10-20T23:43:25.770Z (8 months ago)
- Topics: mqtt, python3, raspberry-pi, systemd-service
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```