nagios – installing nagios core from source

Prerequisites

For RHEL/CentOS users:

1
yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp

Download Nagios Core and Nagios Plugins Tarballs

For all systems, run the following commands in your terminal:

1
2
3
cd /tmp
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz

Adding the Nagios User and Group

Next add the appropriate user and group for the Nagios process the run:

1
2
3
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios

Nagios Core Installation

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

Change to the New Nagios directory and install the packages:

1
cd nagios-4.1.1

For RHEL/CentOS users:

1
./configure --with-command-group=nagcmd

All systems:

1
2
3
4
5
6
7
8
9
10
11
12
make all
make install
make install-init
make install-config
make install-commandmode
make instlal-webconf

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios start

For RHEL/CentOS users:

1
/etc/init.d/httpd start

Create a Default User for Web Access.

Add a default user for Web Interface Access:

1
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Nagios Plugin Installation

1
2
3
4
cd /tmp/nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Nagios Service Setup

The following commands will register the Nagios daemon to be run upon system startup.

1
2
3
4
5
chkconfig --add nagios
chkconfig --level 35 nagios on

chkconfig --add httpd
chkconfig --level 35 httpd on

Nagios Web Interface

After correctly following the procedures you should now be abel to access your Nagios Core installation from a web browser.

Simply use the following:

1
http://<your.nagios.server.ip>/nagios

And log in with credentials you chose when adding the nagiosadmin user to the htpasswd.users file.