Saturday, 21 July 2012

Nagrestconf on Raspberry PI

This post is quite old now, and out of date. There are new instructions for installing nagios and nagrestconf on Raspbian at if you're interested.

So, your Raspberry Pi is set up with Debian (my Pi is running in a cupboard), and now you want to monitor your home network with it. Here's a quick tutorial using nagrestconf to make configuring nagios less of a chore.

Log into the raspberry pi and install gdebi:

apt-get install gdebi

then get the nagrestconf .deb package:


Install nagrestconf and it will automatically install nagios etc.:

gdebi nagrestconf_1.0_all.deb

I had a problem with apache failing to start, which stopped nagios3 from installing. I was able to fix it by adding the www-data group then continuing the install - maybe I had a disk write problem? Fix was:

addgroup www-data
apt-get install --reinstall apache2
dpkg --configure -a
gdebi nagrestconf_1.0_all.deb

If all went well and you see 'Nagrestconf has been configured for' then you should be all set go.

Test that your installation is working by using the setup script

bash /usr/share/doc/nagrestconf/bulk-loading/

You should see a lot of lines in the output that say '[Success]' and the output should end with:

- Apply, Check and Restart

curl -knX POST -d 'json={"folder":"local"}'

curl -knX GET '\{"folder":"local","verbose":"false"\}'
["Total Warnings: 0, Total Errors: 0"]

curl -knX POST -d 'json={"folder":"local"}'
["Config saved and Nagios restart request sent."]


You have tested that the REST interface works so now test that the Web interface works. By default only connections from localhost are allowed to use the nagrestconf gui. Now, I don't run a graphical Desktop on my Raspberry PI so I have to use ssh to forward a port on my linux laptop to the local port on the raspberry pi. This is very easy. Just:

# Run this on the desktop/laptop
# change to the address of your Pi
ssh -L 8181: root@

Then put '' in the Browser's address bar, and you should see the Nagrestconf GUI as shown at the top of this blog entry. The nagios gui is available at the raspberry pi's address plus '/nagios3' and is shown below:

No comments:

Post a Comment