Both SELinux and firewalld have beeen disabled for this lab.

Nagios core

Install required packages :

[root@nagios ~]# yum -y install wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp

Download Nagios core :

[root@nagios ~]# cd /tmp
[root@nagios tmp]# wget

We decide to install Nagios core in “/usr/local/src” directory :

[root@nagios tmp]# cd /usr/local/src

Uncompress the archive :

[root@nagios src]# tar xfz /tmp/nagios-4.1.1.tar.gz

Go to the source directory :

[root@nagios src]# cd nagios-4.1.1

It’s time to create “nagios” user account :

[root@nagios nagios-4.1.1]# groupadd -g 2000 nagios
[root@nagios nagios-4.1.1]# groupadd -g 2001 nagcmd
[root@nagios nagios-4.1.1]# useradd -m -g nagios -u 2000 nagios
[root@nagios nagios-4.1.1]# usermod -a -G nagcmd nagios
echo "nagios:your_password" | chpasswd
[root@nagios nagios-4.1.1]# usermod -a -G nagcmd apache
[root@nagios nagios-4.1.1]# id nagios
uid=2000(nagios) gid=2000(nagcmd) groups=2000(nagcmd),2001(nagcmd)
[root@nagios nagios-4.1.1]# id apache
uid=48(apache) gid=48(apache) groups=48(apache),2001(nagcmd)

Nagios core compilation

Configure Nagios core :

[root@nagios nagios-4.1.1]# ./configure --with-nagios-group=nagios --with-command-group=nagcmd

Install “zip/unzip” packages (“unzip” mandatory for compilation) :

[root@nagios nagios-4.1.1]# yum -y install zip unzip

Compile Nagios core :

[root@nagios nagios-4.1.1]# make all

Install Nagios core :

[root@nagios nagios-4.1.1]# make install

Install init script :

[root@nagios nagios-4.1.1]# make install-init

Install sample comfig files :

[root@nagios nagios-4.1.1]# make install-config

Configure directories for external command file :

[root@nagios nagios-4.1.1]# make install-commandmode

Install files for Apache :

[root@nagios nagios-4.1.1]# make install-webconf

Terminate the installation :

[root@nagios nagios-4.1.1]# cp -R contrib/eventhandlers /usr/local/nagios/libexec
[root@nagios nagios-4.1.1]# chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

You can start Nagios :

  • Check Nagios configuration :
[root@nagios ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 8 services.
        Checked 1 hosts.
        Checked 1 host groups.
        Checked 0 service groups.
        Checked 1 contacts.
        Checked 1 contact groups.
        Checked 24 commands.
        Checked 5 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 1 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

Start it !

[root@nagios nagios-4.1.1]# /etc/init.d/nagios start
Reloading systemd:                                         [  OK  ]
Starting nagios (via systemctl):                           [  OK  ]

Nagios is up & running :

[root@nagios nagios-4.1.1]# systemctl status nagios | head -12
● nagios.service - LSB: Starts and stops the Nagios monitoring server
   Loaded: loaded (/etc/rc.d/init.d/nagios)
   Active: active (running) since Mon 2016-03-14 14:03:54 CET; 1min 43s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13246 ExecStart=/etc/rc.d/init.d/nagios start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nagios.service
           ├─13265 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
           ├─13267 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─13268 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─13269 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           ├─13270 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
           └─13271 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

Keep nagios started across reboot :

[root@nagios ~]# systemctl enable nagios
nagios.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig nagios on

Create an Apache “nagiosadmin” account :

[root@nagios nagios-4.1.1]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

Start Apache now and keep it started across reboot :

[root@nagios nagios-4.1.1]# systemctl start httpd
[root@nagios nagios-4.1.1]# systemctl enable httpd
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/httpd.service.

Nagios plugins installation

Go to “/tmp” :

[root@nagios ~]# cd /tmp

Download Nagios plugins :

[root@nagios tmp]# wget

Go to “/usr/local/src” directory :

[root@nagios tmp]# cd /usr/local/src

And extract this archive :

[root@nagios src]# tar xfz /tmp/nagios-plugins-2.1.1.tar.gz

Configure Nagios plugins :

[root@nagios src]# cd nagios-plugins-2.1.1
[root@nagios nagios-plugins-2.1.1]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios

Compile Nagios plugins :

[root@nagios nagios-plugins-2.1.1]# make

And install it :

[root@nagios nagios-plugins-2.1.1]# make install

Nagios WEB interface

Using a WEB browser on my Windows laptop (here : :











Enter defined user “nagiosadmin” and password to logon :










Your first Nagios information (regarding “localhost”) :















PDF24 Creator    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *