Nagios installation


1. Install dependencies

httpd
php
gcc, glibc-common
gd,gd-devel
make
net-snmp

2. Create user and group for Nagios

useradd nagios
groupadd nagcmd

usermod -G nagcmd nagios
usermod -G nagcmd apache

3. Download and extract nagios core

4. configure the nagios by running below

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

make all

make install

5.  make install-init   ==> To add services in init scripts

6.  make install-commandmode  ==> To use nagios in command mode

7.  make install-config  ==> To install the configuration files

8.  Configuration file locations

/usr/local/nagios/etc/*
/usr/local/nagios/etc/objects/contacts.cfg -> for contact options

9.  make install-webconf   => For installing httpd server configurations

10. Adding users to nagios

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

11. start the httpd server

service httpd start
systemctl start httpd.service

12. Start the nagios server

service nagios start

13. The nagios web ui will be visible under

http://<hostname>/nagios

password would be the username and password given @the step 10


####################################################################
Installing nagios plugins
####################################################################

1. Download the nagios plugin

2. Extract the downloaded plugin

tar -xvf nagios-plugin-xxx.tar.gz

3. Run below commands to build and install

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install

4.To verify the nagios configuration files

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

Thats all!


####################################################################
Adding Hosts to Nagios server
####################################################################

Adding new hosts = nrpe + nagios plugins

Below needs to be done on hosts

1. yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel

2. Create user for nagios

useradd nagios
passwd nagios

3. Download the nagios plugin and extract

Install nagios plugins

copy the nagios plugins to hosts
Extract
./configure
make 
make install

4. change the ownership of /usr/local/nagios dir to nagios:nagios
   chown -R nagios:nagios /usr/local/nagios/libexec


####################################################################
Adding nagios remote plugin executor - nrpe
####################################################################

1. yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel

2. Download and Extract

3. Add user if not already added 

4. make all
   make install-plugin
   make install-daemon
   make install daemon-config
   make install-xinetd

5. chown nagios:nagios /usr/local/nagios
   chown -R nagios.nagios /usr/local/nagios/libexec

6.  vim /etc/xinetd.d/nrpe

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = 127.0.0.1 192.168.100.18 192.168.100.19
}

change the only_from parameter and add the nagios server ip address and current server ip address

7. vim /etc/nrpe

Add below entry
nrpe            5666/tcp                #NRPE

8. service xinetd start

9. check nrpe is working or not

netstat -at |grep nrpe

10. check the nrpe is working fine

/usr/local/nagios/libexec/check_nrpe -H bdmashc01

Comments

Popular posts from this blog

Querying MapR DB tables from Drill

OpenSSL Certificate creations

HTTP Fs Installation