AlexNogard: IT HowTo

Linux & Opensource : Monitoring : Centreon, Nagios, Owncloud ..

By

Howto Install nagios 4.0.1 on Centos 6.4

logo nagios

Nagios is a monitoring tool under GPL licence. This tool lets you monitor servers, network hardware (switches, routers, …), applications and services. A lot of plugins are available (more than 3000) and its big community makes Nagios the biggest and the most maintained open source monitoring tool. This tutorial shows how to install Nagios 4.0.1 on CentOS 6.4.

Nagios 4 is the latest stable release published the 20th of last september. This release improved disk I/O latency, some new configuration variables, and other specifications available here : What’s new in Nagios core 4.X.X.

1 / Prerequisites

After installing your CentOS server, you have to disable selinux & install some packages to make nagios work.

To disable selinux, open the file: /etc/selinux/config

# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing – SELinux security policy is enforced.
#     permissive – SELinux prints warnings instead of enforcing.
#     disabled – No SELinux policy is loaded.
SELINUX=permissive // change this value to disabled
# SELINUXTYPE= can take one of these two values:
#     targeted – Targeted processes are protected,
#     mls – Multi Level Security protection.
SELINUXTYPE=targeted

Now, download all packages you need:

# yum groupinstall “developper tools”

# yum install httpd

2 / Nagios Installation

Create a directory:

# mkdir /root/nagios

# cd /root/nagios

Download nagios-core & plugin:

# wget http://downloads.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.1/nagios-4.0.1.tar.gz?r=http%3A%2F%2Fwww.nagios.org%2Fdownload%2Fcore%2Fthanks%2F%3Ft%3D1382215275&ts=1382215285&use_mirror=freefr
# wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz

Untar nagios core:

# tar xvzf nagios-4.0.1.tar.gz

Go to the nagios dir:

# cd nagios-4.0.1

Configure before make:

# useradd nagios
# groupadd nagios
# usermod -a -G nagios nagios
# ./configure

Make all necessary files for Nagios:

# make all

Installation:

# make install

# make install-init

# make install-commandmode

# make install-config

# make install-webconf

Create a password to log into the web interface:

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

Start the service and start it on boot:

# chkconfig nagios on
# service nagios start

Now, you have to install the plugins:

# cd ..
# tar xvzf nagios-plugins-1.5.tar.gz
# cd nagios-plugins-1.5
# ./configure
# make
# make install

Start the apache service and enable it on boot:

# service httpd start
# chkconfig httpd on

Now, connect to your nagios system:

http://Your-Nagios-IP/nagios and enter login : nagiosadmin & password you have chosen above.

The full nagios configuration howto is available following link.

Nagios 4 is now installed on Centos 6.4 and ready to work :), for any remarks, use comment below 😉

One Response to Howto Install nagios 4.0.1 on Centos 6.4

  1. Kevin says:

    Your directions are incomplete. The “CD NAGIOS” line should read “CD NAGIOS-4.0.1”.
    There is also an error at the “MAKE INSTALL” line stating that their is an invalid user ‘nagios’.
    For someone that knows nothing about Linux I cannot use this document to install Nagios – nor have I found any document online that has exact correct directions.

Leave a Reply

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