Thursday , July 29 2021

Installing Nagios Core on CentOS

Installing Nagios Core on CentOS 5 / 6 & 7

In this tutrial I will install Nagios Core (one of the most powerful and opensource NMS) with Nagios Plugins and NRPE on CentOS version 7, steps for CentOS 5 & 6 also included.

Tools / Addons used in this tutorial:

Operating System:           CentOS 7

Nagios Core  –

Nagios Plugins  –

NRPE  –…..


Install Required Dependencies:

For CentOS 5/6:

# yum install -y gcc gcc-c++ gd-devel gd png png-devel jpeg jpeg-devel zlib zlib-devel php mysql mysql-server mysql-devel make vim mailx wget httpd


# yum install -y gcc gcc-c++ gd-devel gd zlib zlib-devel php mariadb mariadb-server mariadb-devel make vim mailx wget mlocate httpd

Create Nagios Group & User:

# groupadd -g 9000 nagios
# groupadd -g 9001 nagcmd
# useradd -u 9000 -g nagios -G nagcmd -d  /usr/local/nagios -c “Nagios Admin” nagios
# passwd nagios                                      //set password for nagios user…

Installing Nagios Core:

# cd /usr/local/src
# wget
# tar xzvf nagios-4.0.8.tar.gz
# cd nagios-4.0.8
# ./configure –sysconfdir=/etc/nagios –localstatedir=/var/nagios –with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
# make install-webconf
# chkconfig nagios on
# chkconfig httpd on
# systemctl enable httpd.service                       //CENTOS 7
# systemctl enable nagios                                 //CENTOS 7


Installing Nagios Plugins:

# cd /usr/local/src
# wget
# tar xzvf nagios-plugins-2.0.3.tar.gz
# cd nagios-plugins-2.0.3
# ./configure –sysconfdir=/etc/nagios –localstatedir=/var/nagios
# make
# make install


Testing Nagios Plugins:

# /usr/local/nagios/libexec/check_icmp -H <TargetIP>

1- Nagios Plugins Test  Installing Nagios Core on CentOS 1 Nagios Plugins Test

 {{ if status OK, it means, plugins installed correctly}}

Installing NRPE:

We are installing NRPE on NMS server because we need nrpe check command script.

Installing Required Deps:

# yum install openssl-devel -y
# cd /usr/local/src
# wget
# tar xzvf nrpe-2.15.tar.gz
# cd nrpe-2.15
# ./configure –enable-openssl
# make all
# make install-plugin


Creating Nagios Web Interface User Access File:

# cd /etc/nagios
# htpasswd -cm htpasswd.users nagios                          //Enter password when asked, this will be password for nagios user
# chown apache htpasswd.users
# chmod 600 htpasswd.users
# chmod 755 -R /usr/local/nagios
# service nagios start
# service httpd restart
# systemctl restart httpd.service                                 //CENTOS 7


# service iptables stop
# systemctl stop firewalld                                 //CENTOS 7
# systemctl disable firewalld                                 //CENTOS 7
# setenforce 0

Access Nagios Web Interface by entering following address in browser:


If you want to browse any other URL like /nms rather then /nagios:

# vim /usr/local/nagios/share/

– Set “Base_URL” to /nms/cgi-bin               rather then              /nagios/cgi-bin


2- Nagios Access  Installing Nagios Core on CentOS 2 Nagios Access


Creating VirtualHost to:    

#   vim /etc/httpd/conf/httpd.conf

Add Following lines at last of the configuration file:

<VirtualHost *:80>
DocumentRoot /usr/local/nagios/share/

Save Configuration file, restart Apache server and browse to:

Error in Log file:

 script not found or unable to stat: /var/www/cgi-bin/statusjson.cgi, referer:


# mkdir /var/www/cgi-bin

# cp /usr/local/nagios/sbin/statusjson.cgi /var/www/cgi-bin

# service httpd restart




–     Adding Linux/Unix host in Nagios Core for Monitoring

–     Adding Windows host in Nagios Core for Monitoring

About Muhammad Attique

Check these out :)

Installing &#038; Configuring WingIDE on Kali Linux (64-bit) wing

Installing & Configuring WingIDE on Kali Linux (64-bit)

Wingware Python IDE a.k.a. Wing IDE is a full-featured Python IDE designed for professional programmers. …

Leave a Reply

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

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.