Introduction
Over the past week, I had multiple questions how to monitor RaspBerry Pi with Nagios. Monitoring is crucial to pro-actively find out any issues that might come up. There are multiple ways to achieve this. I’ll try to build up this ‘how to’ from the ground, starting with using the standard traditional method, which is using the official Nagios NRPE Agent.
NSClient++ does not yet support Raspbian for now. Michael Medin told me in this forum thread that he is planning to port it once he finds some spare time.
It’s also possible to install Go and Telegraf on your Raspbian, but I haven’t got the time to test that.
How to Monitor RaspBerry Pi with NRPE Agent?
The code below worked fine for me on Raspbian Jessie
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
wget https://github.com/NagiosEnterprises/nrpe/archive/nrpe-2-15.tar.gz -O /tmp/nrpe-2-15.tar.gz mkdir -p /usr/local/nagios tar -zxvf /tmp/nrpe-2-15.tar.gz -C /usr/local/nagios mv /usr/local/nagios/nrpe-nrpe-2-15/ /usr/local/nagios/nrpe-2-15/ ln -s /usr/lib/arm-linux-gnueabihf/libssl.so /usr/lib/libssl.so cd /usr/local/nagios/nrpe-2-15 ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/arm-linux-gnueabihf --enable-command-args useradd nagios make all make install make install-plugin make install-daemon make install-xinetd mkdir /usr/local/nagios/etc |
Create nrpe.cfg in /usr/local/nagios/etc
The relevant part of my nrpe.cfg looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
log_facility=daemon pid_file=/var/run/nagios/nrpe.pid server_port=5666 nrpe_user=nagios nrpe_group=nagios allowed_hosts=127.0.0.1,<ip-of-your-Nagios-server-here> dont_blame_nrpe=1 allow_bash_command_substitution=0 debug=0 command_timeout=60 connection_timeout=300 command[check_load]=/usr/lib/nagios/plugins/check_load $ARG1$ command[check_mem]=/usr/lib/nagios/plugins/check_mem $ARG1$ command[check_procs]=/usr/lib/nagios/plugins/check_procs $ARG1$ command[check_swap]=/usr/lib/nagios/plugins/check_swap $ARG1$ command[check_users]=/usr/lib/nagios/plugins/check_users $ARG1$ |
make sure to replace <ip-of-your-Nagios-server-here> with (you never guess) the ip of your Nagios server.
Let me know if you experience any issues.
Grtz
Willem