Nagios Core 4 installation guide on Debian 8 'Jessie'

Installing prerequisites :

apt-get install gcc make binutils cpp libpq-dev libmysqlclient-dev libssl1.0.0 libssl-dev pkg-config  libgd2-xpm-dev libgd-tools perl libperl-dev libnet-snmp-perl snmp apache2 libapache2-mod-php5 unzip

Obtaining Nagios Core & Nagios Plugins 

Last version is available here

cd /usr/local/src/

Extracting the Nagios Core and Plugins source

mkdir /usr/src/nagios4
cd /usr/src/nagios4/
tar -xzf /usr/local/src/nagios-4.1.1.tar.gz 
tar -xzf /usr/local/src/nagios-plugins-2.1.1.tar.gz 

Setting up users and Groups:

groupadd nagios
groupadd nagioscmd
useradd -g nagios -G nagioscmd -d /opt/nagios nagios
usermod -G nagioscmd www-data

Compiling and Installing Nagios Core 4

mkdir -p /opt/nagios /etc/nagios/ /var/nagios/ 
chown nagios:nagios /opt/nagios/ /etc/nagios/ /var/nagios/
cd nagios-4.1.1/
/configure --prefix=/opt/nagios --sysconfdir=/etc/nagios --localstatedir=/var/nagios --libexecdir=/opt/nagios/plugins --with-command-group=nagioscmd
make all
make install
make install-commandmode
make install-config

Compiling and Installing nagios plugins : 

cd /usr/src/nagios4/nagios-plugins-2.1.1/
./configure --prefix=/opt/nagios --sysconfdir=/etc/nagios/ --localstatedir=/var/nagios/ --libexecdir=/opt/nagios/plugins/
make all
make install

Checking the Installation : 

su -c '/opt/nagios/bin/nagios /etc/nagios/nagios.cfg' nagios

Nagios init script for Debian 8 'Jessie' :

cp /etc/init.d/skeleton /etc/init.d/nagios
vim /etc/init.d/nagios

"Add the following entries in the file " 

DAEMON_ARGS="-d /etc/nagios/nagios.cfg"

Staring Nagios service and make it auto startup after booting : 

chmod +x /etc/init.d/nagios
/etc/init.d/nagios start
insserv nagios

Installing web panel : 

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf

Enabling apache rewrite and cgi module :

sudo a2enmod rewrite
sudo a2enmod cgi
sudo service apache2 restart

/etc/init.d/nagios restart
/etc/init.d/apache2 restart

Set Nagios admin password :

 htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

Access Nagios dashboard:



Post a Comment