Skip to main content

Nagios Server Installation

Posted in

Instructions for basic configuration of a Nagios server for monitoring servers, routers, applications and more.

Prerequisites
Install the Apache web server.
Install the neccessary graphic libraries:

yum -y install libpng-devel libjpeg-devel gd-devel

Requires libtool?
yum -y install libtool

Nagios Base Installation
Create a nagios user and group for the program to run under:

adduser nagios

Create the installation directory:
mkdir /usr/local/nagios
chown nagios.nagios /usr/local/nagios

Add the command file group and add the Apache user to it (in our case, that user is "nobody"):
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nobody
/usr/sbin/usermod -G nagcmd nagios

Download the latest Nagios source code (3.2.1 at time of writing):

Run the configure script:
./configure --with-command-group=nagcmd

Compile and install the binaries:
make all
make install
make install-commandmode

If you want to use the included init scripts, install them into /etc/rc.d/init.d:
make install-init

Initial Configuration
Install the sample configuration files:

make install-config

The sample files, installed in /usr/local/nagios/etc will work for getting Nagios started with just one change. Edit /usr/local/nagios/etc/objects/contacts.cfg and change the email address of the nagiosadmin contact.