How to install Nagios Core server 4.4.3 on RHEL 6/7 & CentOS 6/7

This post will help you to know How to install Nagios Core server 4.4.3 on RHEL 6/7 & CentOS 6/7.

Nagios is a powerful monitoring tool. It will help to monitor a infrastructure.

It will monitor applications, service and entire infrastructure.

Required Packages:

  1. httpd
  2. php
  3. php-cli
  4. gcc
  5. unzip
  6. wget
  7. glibc
  8. glibc-common
  9. gd
  10. gd-devel
  11. net-snmp
[[email protected] ~]yum install httpd php php-cli gcc unzip wget glibc glibc-common gd gd-devel net-snmp

As we have installed httpd and this will be useful when we access the Nagios core to manage through web console.

 [[email protected] yumrepo]# systemctl start httpd 

Now create Nagios user account using below command:

[[email protected] yumrepo]# useradd Nagios
[[email protected] yumrepo]# passwd nagios
Changing password for user nagios.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.

Now we need to create a group “nagcmd” to setup Nagios and then add the users “nagios” & “apache”   to be a part of group: nagcmd

[[email protected] yumrepo]# groupadd nagcmd
[[email protected] yumrepo]# usermod -a -G nagcmd nagios
[[email protected] yumrepo]# usermod -a -G nagcmd apache

Ñow its time to start Nagios Core server installation

Since Nagios third party tool, we need to download first for installation using below commands:

[[email protected] ~]# cd /opt
[[email protected] opt]# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.3.tar.gz
[[email protected] opt]# tar -xvf nagios-4.4.3.tar.gz
[root@nagiosrv nagios-4.4.3]# ./configure --with-command-group=nagcmd
[[email protected] nagios-4.4.3]# make all
[[email protected] nagios-4.4.3]# make install
[[email protected] nagios-4.4.3]# make install-init
[[email protected] nagios-4.4.3]# make install-daemoninit
[[email protected] nagios-4.4.3]# make install-commandmode
[[email protected] nagios-4.4.3]# make install-config
[[email protected] nagios-4.4.3]# make install-exfoliation

Now configure Apache for Nagios installation using below command:

[[email protected] nagios-4.4.3]# make install-webconf

Will configure Apache authentication for nagiosadmin which is default user. Don’t change this username. If you are changing then need to do more changes in configuration file.

[[email protected] nagios-4.4.3]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Now restart the apache

[[email protected] nagios-4.4.3]# systemctl restart httpd

As a next step need to install Nagios plugins, once installed Nagios core using below commands:

[[email protected] nagios-4.4.3]# cd /opt
[[email protected] opt]# wget http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
[[email protected] opt]# tar -xvf nagios-plugins-2.2.1.tar.gz
[[email protected] opt]# cd nagios-plugins-2.2.1

Now install and compile the plugins using below command:

[[email protected] nagios-plugins-2.2.1]# ./configure --with-nagios-user=nagios --with-nagios-group=Nagios
[[email protected] nagios-plugins-2.2.1]# make
[[email protected] nagios-plugins-2.2.1]# make install

We installed Nagios core and plugins. So, now will check and verify the configuration using below command:

[[email protected] nagios-plugins-2.2.1]#
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

The output should give 0 Errors and 0 Warnings. If you get the same, then will start the Nagios like below

[[email protected] nagios-plugins-2.2.1]# systemctl start
nagios     

Check SELinux mode using below command:

[[email protected] ~]getenforce
Enforcing

If SELinux is in Enforcing mode, Than change it to Permissive mode or disable it like below

[[email protected] ~]# setenforce 0

Now make sure to enable web server permanently in firewall using below command:

[[email protected] ~]# firewall-cmd --permanent
--add-service=http

Execute below command to make affect in firewall changes which we did using our previous command

[[email protected] ~]# firewall-cmd –reload

Finally we have done everything and now will check whether the web console working on not

Enter url like below in your web browser and replace the IP_ADDR with your server ip

http://IP_ADDR/nagios

It will ask for the username and password. Remember that we already created a user name “nagiosadmin”. We can use that to login the console.

How to install Nagios Core server 4.4.3 on RHEL 6/7 & CentOS 6/7

Enter the nagiosadmin credentials and the web console looks like below

How to install Nagios Core server 4.4.3 on RHEL 6/7 & CentOS 6/7

From the left side pan click on “Hosts” and it will show list of hosts which is added for monitoring.
Since, we doesn’t added any host, it will show only localhost, which is Nagios server like below

How to install Nagios Core server 4.4.3 on RHEL 6/7 & CentOS 6/7

Finally we installed and configured Nagios server. Thanks for readin

Leave a Reply

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