A daemon written in C for reading system data from Raspberry PI. The read data will be published to an MQTT server with a given topic.
These instructions will get you a copy of the project up and running on your local machine.
You need a Raspberry PI board.
The daemon uses 2 non standard libraries which must be installed first:
libconfig-dev - This library allows parsing, manipulating and writing structured configuration files.
apt-get install libconfig-dev
libmosquitto-dev - Library for implementing MQTT version 3.1/3.1.1 clients.
apt-get install libmosquitto-dev
MQTT server - MQTT server running and reachable form the Raspberry.
- Build the executable file by running "make"
cd ~/rpipubmqttd
make
- Edit the config file rpipubmqttd.conf according to your needs
nano rpipubmqttd.conf
- Copy the binary rpipubmqttd and the config file rpipubmqttd.conf to /opt/rpipubmqttd/
sudo mkdir /opt/rpipubmqttd
sudo cp rpipubmqttd /opt/rpipubmqttd
sudo cp rpipubmqttd.conf /opt/rpipubmqttd
- Copy the service configuration file rpipubmqttd.service to /lib/systemd/system/
sudo cp rpipubmqttd.service /lib/systemd/system/
- Enable RPIpubMqttDaemon service
sudo systemctl enable rpipubmqttd.service
- Start RPIpubMqttDaemon.service
sudo systemctl start rpipubmqttd.service
- check syslog for errors
sudo tail -f /var/log/syslog
- Start an MQTT client and subscripe the topic configured in the config file. You should get a string in JSON format with the read data.
{"CPU_Temp":"45.08","Disk_Usage":"20.10"}
This project is licensed under the GNU General Public License - see the LICENSE file for details