Monitor Raspberry-pi Temprature with Zabbix

I installed Raspberry-pi couple of months ago. I observed that at times Raspberry case used to get hot. Also, I have observed that Raspberry-pi gets hanged and I have to reboot it to start working.

To find the cause I planned to install monitoring of Raspberry-pi. Along with other monitoring checks like CPU Processes, Available Memory and so on, I planned to monitor CPU temperature as well.

The package lm-sensors does not work, since it does not get temperature sensors from the hardware.

The below command allows to get temperature:

Show Raspberry Pi GPU temperature

root@raspberrypi:/home/pi# vcgencmd measure_temp

root@raspberrypi:/home/pi# /opt/vc/bin/vcgencmd measure_temp

Install Zabbix agent on Raspberry-Pi:

root@raspberrypi:/home/pi# apt-get install zabbix-agent
Reading package lists… Done
Building dependency tree
Reading state information… Done
zabbix-agent is already the newest version.

Configure Zabbix Agent

Open zabbix agent configuration file and edit below mentioned parameters accordingly:

root@raspberrypi:/home/pi# vim /etc/zabbix/zabbix_agentd.conf




Temperature gathering on Zabbix Client

Creating a file to gather data:

root@raspberrypi:/su – pi

pi@raspberrypi:/home/pi# cd /home/pi/
pi@raspberrypi:/home/pi# vim

Copy below text in the file to generate temperature stats:

/usr/bin/zabbix_sender -z zabbix-server-ip -s “raspberrypi” -k rb.temprature -o `cat /sys/class/thermal/thermal_zone0/temp`

Now settings this command in cron to execute on time:

pi@raspberrypi:/home/pi# crontab -e

Enter below text in crontab file to send temeprature to Zabbix server after every 30 minutes duration.

*/30 * * * * /home/pi/ >> /home/pi/crons.log 2>&1

Now Configure Zabbix Server Front-end

We need to add the Host in Zabbix as usual. This is usual process of adding a Host. Once its done. We need to enter in the Host and create an “Item” by clicking on “Create Item” button.

We need to follow the below sequence to create an Item:

Configurations > Hosts > raspberrypi (the host-name) > Items > Create Item

Now follow the screen-shot below:

zabbix create item

In Allowed hosts parameter we need to enter client IP address.

The Key value can be set to any other word but in we need to ensure this should be same in Trigger

Now we need to create a Trigger to generate alert as done in below screen-shot:

create trigger

Expression {raspberrypi:rb.temprature.last()}>60000 value which means if the temperature is above 60 Degrees then generate an alert

Later values can set according to screen-shot

This is all we have to do to get temperature from Raspberry pi and monitor with Zabbix.

Let me know your thoughts in comments below and feel free to share any issues being faced in between.

Leave a Reply

Your email address will not be published.