Install Nagios 4 on RaspberryPI-Jessie

This guide was originally written for Ubuntu but will work for Raspbian (Debian Jessie) flavor for RasberryPi as well. It might work for all debian distros but not guaranteed, you can try it out yourself. I “borrowed” this guide from here and rewrote it to fix the mistakes they had in their article.

NOTE: This guide is valid only for RaspberryPi Jessie.

The steps below assume you have Raspbian Jessie installed on your Raspberry PI 3.

Login to Raspbian. Default login is:

Become root user

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 use password

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

mkdir /tmp
cd /tmp

Untar the downloaded files

tar zxvf nagios-4.1.1.tar.gz
tar zxvf nagios-plugins-2.1.1.tar.gz

And then 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

Run this command to successfully install-webconf. (problem area not sure the below is 100% correct)

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf
a2ensite nagios
service apache2 reload

Leave a Reply