As I was working on a VOC sensor setup with Raspberry Pi, I also wanted to monitor the Pi's board temperature. Turns out on Raspbian there is already a command prepared for this:
pi@raspberrypi:~ $ /usr/bin/vcgencmd measure_temp
temp=39.2'C
This Raspberry Pi is already integrated into an Icinga 2 monitoring. Wouldn't it be nice to use the already running NRPE server and have a plugin for this?
Here you go: check_rpi_temp does exactly that. It reads the current temperature from the board, compares it against (optional) thresholds and can output data in either Celsius (default) or in Fahrenheit. Thanks to the performance data you can create historical graphs for the Raspberry Pi board temperature:
The usage is straight forward:
pi@raspberrypi:~ $ /usr/lib/nagios/plugins/check_rpi_temp.py -w 50 -c 60
RPI TEMP OK: Temperature 40.80 degrees c |rpi_temp=40.80;50.00;60.00;;
Or if you prefer Fahrenheit:
pi@raspberrypi:~ $ /usr/lib/nagios/plugins/check_rpi_temp.py -w 90 -c 105 -u f
RPI TEMP CRITICAL: Temperature 105.44 is higher than critical threshold (105.00) |rpi_temp=105.44;90.00;105.00;;
Important note: You need to make sure the user running the command is able to execute vcgencmd. For example if you use the 'nagios' user (default in an NRPE setup), the command fails:
nagios@raspberrypi:~$ /usr/bin/vcgencmd measure_temp
VCHI initialization failed
By default the "pi" and the "root" user are able to run this command. So either define a sudoers rule or create a new user with the same privileges as the pi user.
I (probably) won't create a dedicated page in monitoring-plugins for this script; all the infos and the plugin itself is available on a dedicated repository on GitHub.
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office OpenSearch PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder