How to Install nagios for cloudera or hadoop or hortonworks and monitor all cloudera or hadoop or hortonworks hosts using nagios

you must have superuser privileges on the CentOS 7 server that will run Nagios. A LAMP stack is also required.


Step 1: Install LAMP

Run below commands:

yum update -y
sudo yum install httpd
sudo service httpd start
ifconfig eth0 | grep inet | awk '{ print $2 }'

Install Mysql Server:

yum install wget -y
md5sum mysql57-community-release-el7-9.noarch.rpm
sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm                

Grep Temporary Password:

sudo grep 'temporary password' /var/log/mysqld.log              

Mysql Server Secure Installation:


sudo /usr/bin/mysql_secure_installation

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y                                            
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Run Below Commands:

sudo yum install php php-mysql
sudo service mysqld start

sudo chkconfig httpd on
sudo chkconfig mysqld on            

To set this up, first create a new file:

sudo vi /var/www/html/info.php

Add in the following line:




Then Save and Exit.

Run Below Commands:

sudo service httpd restart           


Install Nagios:

sudo yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd unzip

Create Nagios User and Group:

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios

Install Nagios Core:

cd ~
curl -L -O

Extract the Nagios archive with this command:

tar xvf nagios-*.tar.gz
cd nagios-*
./configure --with-command-group=nagcmd 

Compile Nagios:

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

We must add the web server user, apache, to the nagcmd group:

sudo usermod -G nagcmd apache

cd ~
curl -L -O
tar xvf nagios-plugins-*.tar.gz
cd nagios-plugins-*
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl

Now compile Nagios Plugins with this command:

sudo make install

cd ~
curl -L -O

tar xvf nrpe-*.tar.gz
cd nrpe-*
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu

Now build and install NRPE and its xinetd startup script with these commands:

make all
sudo make install
sudo make install-xinetd
sudo make install-daemon-config

Open the xinetd startup script in an editor:

sudo vi /etc/xinetd.d/nrpe

Modify the only_from line by adding the private IP address of the your Nagios server

cloudera nagios server setup 1

only_from =

Save and exit. and restart xinetd service

sudo service xinetd restart

Configure Nagios into cloudera and hadoop hortonworks server


sudo vi /usr/local/nagios/etc/nagios.cfg

Now find an uncomment this line by deleting the #:

Save and exit.


Now create the directory that will store the configuration file for each cloudera or hadoop or hortonworks server that you will monitor:

sudo mkdir /usr/local/nagios/etc/servers

Configure Email for cloudera or hadoop or hortonworks servers alerts

sudo vi /usr/local/nagios/etc/objects/contacts.cfg

email                         ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
Save and exit.


Configure check_nrpe Command


sudo vi /usr/local/nagios/etc/objects/commands.cfg

Add the following to the end of the file:

define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

Save and exit.


Configure Apache - Use htpasswd to create an admin user, called "nagiosadmin", that can access the Nagios web interface:


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

Enter a password at the prompt. Remember this login, as you will need it to access the Nagios web interface.

Run below commands

sudo systemctl daemon-reload
sudo systemctl start nagios.service
sudo systemctl restart httpd.service
sudo chkconfig nagios on

Nagios Running into cloudera or hadoop or hortonworks server, so let's try and log in.



Nagios host tab.