Its now possible to install latest Nagios CORE version on Raspbian by following the steps in this article. Before writing this article I Googled for the same but couldn’t find a single article covering install of latest version of Nagios on RasberryPi hence this guide. It has been fully tested and working on my personal RasPi.
This guide was originally written for Ubuntu but will work for Raspbian (Debian Wheezy) flavour for RasberryPi as well. It might work for all debian distros but not guranteed, you can try it out yourself.
UPDATE: This guide is also now applicable to Nagios 4.1.1 (released 19/08/2015)
NOTE: This guide is valid only for only RaspberryPi Debian Wheezy. I have created a new article for Jessie
See ALSO: NRPE agent install for RasPi
Step-by-Step Install Procedure:
Become root user
# su
OR
# sudo -i
Download required packages via YUM.
# apt-get install apache2 libapache2-mod-php5 build-essential libgd2-xpm-dev
Create Nagios User
# /usr/sbin/useradd -m -s /bin/bash nagios
Change “nagios” user password. Not required but optional
# passwd nagios
Now Create a group for allowing external comands via the WEB UI and then add both Nagios and Apache user to it.
# /usr/sbin/groupadd nagcmd
# /usr/sbin/usermod -a -G nagcmd nagios
# /usr/sbin/usermod -a -G nagcmd www-data
Now download Nagios Core and Plugins from Nagios website to the /tmp directory. Latest versions as of now are Download Nagios 4.1.1 & Download Nagios Plugins 2.1.1
Create a directory for Nagios downloads
# cd /tmp
# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
# wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
Untar the downloaded files
# tar zxvf nagios-4.1.1.tar.gz
# tar zxvf nagios-plugins-2.1.1.tar.gz
And the you will get 2 folders with the name “nagios-4.1.1” & “nagios-plugins-2.1.1”
First we will start with Nagios Core Install.
Change directory to Nagios 4.1.1
# cd /tmp/nagios-4.1.1
Compile the source and install it. All the files would go into “/usr/local/nagios/”
# ./configure --with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf
NOTE: If you come across an error while running install-webconf, please refer to the steps below.
Error:
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
/usr/bin/install: cannot create regular file ‘/etc/httpd/conf.d/nagios.conf’: No such file or directory
Makefile:296: recipe for target 'install-webconf' failed
make: *** [install-webconf] Error 1
Run this command to successfully install-webconf.
# /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf
Next would be to create a user for loggng into Nagios WEB UI.
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
*nagiosadmin is the user for WEB UI. You can user your preffered name.
Once that is done need to restart the Apache Service
# /etc/init.d/apache2 reload
Now we need to install the Plugins for Nagios
Change directory to nagios-plugins-2.1.1
# cd /tmp/nagios-plugins-2.1.1
Then compile & install the plugins
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install
Then Make sure that Nagios service starts up on runtime/ when the system boots up.
# ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Verify the install for any errors
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If any errors, please post your query via Contact Us and we will aim to get it resolved.
If no errors reported then start the Nagios service.
# /etc/init.d/nagios start
You are now ready to login to Nagios Web Interface via the browser (recommended would be Firefox)
http://nagios-server-URL/nagios
*Use your host IP or the hostname follwed by /nagios.
If you encounter any errors during the process, let us know via Contact Us and will get it resolved promptly.