Centos 6.5 – Nagios 4.0.7 – How to monitor a remote server via NRPE

The following instructions assume that Nagios was installed from source. With an RPM install the locations of some files may be different. However the overall principal is the same.

In Nagios you can monitor a remote server by either ding a check on the remote server by not invoking any internal command with in it or by monitoring a remote server by actually having the Nagios server invoke a command on the remote server. An example would be a simple PING check versus if a service is running on the remote server. The Ping check can be done from the Nagios server with out having to call any commands on the remote server. However, in order to check if a process is still up and running you would have to setup the remote server to do that specif check.

In order for the second type of check to be completed NRPE will used. NRPE is a utility which allows you to execute remote commands on the remote server you are monitoring. NRPE service will need to be installed on the Nagios server and on the remote server we are monitoring. When we want to do a remote check on a remote server we will have to call upon NRPE from the Nagios server.

An example of setting up the CHECK_DISK plugin.  This plugin checks the disk space on the remote server we are monitoring.

Continue reading

Share Button

Nagios Core – How inheritance works in Nagios. A basic example.

The material below just illustrates the logic behind adding a remote host for monitoring under Nagios. It does not do a step by step account on how to add a remote host. Reason being is because one must understand the basic logic behind these configuration files. If the logic is not grasped then big miss configurations are bound to happen.

There are several configuration files that need consideration. If you have performed a manual install of NAGIOS Core the configuration files will reside under /usr/local/nagios/etc/

The main configuration file for Nagios is /usr/local/nagios/etc/nagios.cfg Under that file the location of the OBJECT Configuration files is defined. Below is the default structure of these configuration files.

# OBJECT CONFIGURATION FILE(S)
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
cfg_file=/usr/local/nagios/etc/objects/switch.cfg
cfg_file=/usr/local/nagios/etc/objects/printer.cfg

Continue reading

Share Button

NAGIOS – How to do a WHOIS and SSL expiration check

Two plugins will be installed in order to do the WHOIS and SSL expiration checks. The directories of interest for NAGIOS for this case are:

Plugin Config files
/usr/local/nagios/etc/objects/
|–commands.cfg (This is where we do the definition for the service)
|–localhost.cfg (This is where we will define the thresholds)

Plugin files location
/usr/local/nagios/libexec/
|–nagios-check-crt.sh (The script that will check the SSL expirations)
|–nagios-check-dns-exp.tcl (The script that will check the WHOIS expiration)

 

Continue reading

Share Button

NAGIOS – How to setup Nagios v4 from source on Centos 6.5

The following commands will install all the required packcages to have NAGIOS up and running. Make sure to install the latest package of NAGIOS. In the “wget” command enter the latest release.

 

yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp
useradd nagios
groupadd nagcmd
usermod -G nagcmd nagios
usermod -G nagcmd apache
mkdir /root/nagios
cd /root/nagios
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-X.X.X.tar.gz
wget https://www.nagios-plugins.org/download/nagios-plugins-X.X.tar.gz
tar –xvf nagios-X.X.X.tar.gz
tar –xvf nagios-plugins-X.X.tar.gz
cd nagios-X.X.X
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd start
cd /root/nagios
cd nagios-plugins-X.X
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --add httpd
chkconfig --level 35 httpd on
service nagios start 
Share Button