Share, , Google Plus, Pinterest,

Print

Posted in:

Nagios Core 3.5.0 CentOS 6 Install

About Nagios Core

Perhaps you’ve heard it before, but let’s hear it again – “Nagios Is The Industry Standard In IT Infrastructure Monitoring”. It is used to for monitoring and alerting of your servers, switches applications and services. It is an open source system, network and application monitoring software. Open source also means it is fully customizable. You can change the way it looks and works too. You can write your own scripts and add custom checks.

Since we are installing the latest stable release of Nagios Core 3.5.0 (2013-03-15) on CentOS we will need to configure and compile it. It is possible to install Nagios Core on CentOS via RPM from EPEL repository, but the latest release available is 3.4.4 (2013-01-12).

Nagios Vatour
Nagios Vatour

UPDATE: Jump to the latest post on Nagios – Running Nagios Core 4.1.1. on CentOS 7

Let’s start with our How To install Nagios Core guide!

1. Install operating system

Install Linux operating system on a server. (I chose the latest CentOS 6.4 64bit – minimal install. Here is a How to install CentOS minimal.)

2. Install EPEL repository

rpm -ivh http://ftp-stud.hs-esslingen.de/pub/epel/6/i386/epel-release-6-8.noarch.rpm

3. Update operating system

Do a full update of newly installed CentOS 6.4 64bit.

4. Download Nagios Core

Download the latest tarball from http://www.nagios.org and transfer it to your CentOS server.

5. Install dependencies

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

6. Create Nagios user and group

useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios

7. Extract tarball

tar -xvzf nagios-VERSION.tar.gz

8. Configure

cd nagios
./configure --with-command-group=nagcmd

9. Make

make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

 

After running all of the above something like this should be printed out:

*** Configuration summary for nagios 3.5.0 03-15-2013 ***:
 General Options:
 -------------------------
 Nagios executable: nagios
 Nagios user/group: nagios,nagios
 Command user/group: nagios,nagcmd
 Embedded Perl: no
 Event Broker: yes
 Install ${prefix}: /usr/local/nagios
 Lock file: ${prefix}/var/nagios.lock
 Check result directory: ${prefix}/var/spool/checkresults
 Init directory: /etc/rc.d/init.d
 Apache conf.d directory: /etc/httpd/conf.d
 Mail program: /bin/mail
 Host OS: linux-gnu
 Web Interface Options:
 ------------------------
 HTML URL: http://localhost/nagios/
 CGI URL: http://localhost/nagios/cgi-bin/

10. Check Nagios Core configuration

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

Probably everything is OK so no errors are found.

11. Start services

/etc/init.d/nagios start /etc/init.d/httpd start

12. Install Nagios plugins

yum install nagios-plugins-all -y

13. Link eventhandlers

Since we configured and compiled the latest Nagios Core version on our CentOS the plugins installed via yum are installed on a different location. We can fix this by deleting libexec folder and link it to nagios plugins install location – copy eventhandlers folder

rm -rf /usr/local/nagios/libexec
cd /usr/local/nagios/
ln -s /usr/lib64/nagios/plugins/ libexec
chown nagios:nagios -R libexec

14. Create Nagios WEB user

htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart

 

Nagios Core 3.5.0 on CentOS is finished. Your nagios instance should now be accessible if you point your browser to your server IP or hostname – something like http://hostname.domainname.com/nagios or http://IPADDR/nagios

The next step is to add your hosts and services to your Nagios configuration and start monitoring them! Read my Nagios configuration – How to configure Nagios guide.