search
top

Installing Nagios Part 2 – The Agents

In following with a previous post on installing Nagios we are ready to move to installing the agents. In particular Linux, Solaris 10 and Windows agents to allow Nagios to do what it does best and monitor.

Linux

For my installation I am using CentOS 6.2 for which the EPEL repository has all the packages I need for NRPE and Nagios Plugins.

# yum search nagios

nagios.x86_64 : Nagios monitors hosts and services and yells if somethings breaks
nagios-common.x86_64 : Provides common directories, uid and gid among nagios-related packages
nagios-devel.i686 : Provides include files that Nagios-related applications may compile against
nagios-devel.x86_64 : Provides include files that Nagios-related applications may compile against
nagios-plugins.x86_64 : Host/service/network monitoring program plugins for Nagios
nagios-plugins-all.x86_64 : Nagios Plugins – All plugins
nagios-plugins-apt.x86_64 : Nagios Plugin – check_apt
nagios-plugins-bdii.x86_64 : Nagios Plugin – check_bdii_entries
nagios-plugins-breeze.x86_64 : Nagios Plugin – check_breeze
nagios-plugins-by_ssh.x86_64 : Nagios Plugin – check_by_ssh
nagios-plugins-check-updates.x86_64 : A Nagios plugin to check if Red Hat or Fedora system is up-to-date
nagios-plugins-check_sip.x86_64 : A Nagios plugin to check SIP servers and devices
nagios-plugins-cluster.x86_64 : Nagios Plugin – check_cluster
nagios-plugins-dhcp.x86_64 : Nagios Plugin – check_dhcp
nagios-plugins-dig.x86_64 : Nagios Plugin – check_dig
nagios-plugins-disk.x86_64 : Nagios Plugin – check_disk
nagios-plugins-disk_smb.x86_64 : Nagios Plugin – check_disk_smb
nagios-plugins-dns.x86_64 : Nagios Plugin – check_dns
nagios-plugins-dpm-disk.x86_64 : Nagios probes to be run in the DPM disk nodes
nagios-plugins-dpm-head.x86_64 : Nagios probes to be run in the DPM head node
nagios-plugins-dummy.x86_64 : Nagios Plugin – check_dummy
nagios-plugins-file_age.x86_64 : Nagios Plugin – check_file_age
nagios-plugins-flexlm.x86_64 : Nagios Plugin – check_flexlm
nagios-plugins-fping.x86_64 : Nagios Plugin – check_fping
nagios-plugins-game.x86_64 : Nagios Plugin – check_game
nagios-plugins-hpjd.x86_64 : Nagios Plugin – check_hpjd
nagios-plugins-http.x86_64 : Nagios Plugin – check_http
nagios-plugins-icmp.x86_64 : Nagios Plugin – check_icmp
nagios-plugins-ide_smart.x86_64 : Nagios Plugin – check_ide_smart
nagios-plugins-ifoperstatus.x86_64 : Nagios Plugin – check_ifoperstatus
nagios-plugins-ifstatus.x86_64 : Nagios Plugin – check_ifstatus
nagios-plugins-ircd.x86_64 : Nagios Plugin – check_ircd
nagios-plugins-lcgdm.x86_64 : Nagios probes to be run remotely against DPM / LFC nodes
nagios-plugins-lcgdm-common.x86_64 : Common libraries and files to all LCGDM nagios packages
nagios-plugins-ldap.x86_64 : Nagios Plugin – check_ldap
nagios-plugins-lfc.x86_64 : Nagios probes to be run in the LFC node
nagios-plugins-linux_raid.x86_64 : Nagios Plugin – check_linux_raid
nagios-plugins-load.x86_64 : Nagios Plugin – check_load
nagios-plugins-log.x86_64 : Nagios Plugin – check_log
nagios-plugins-mailq.x86_64 : Nagios Plugin – check_mailq
nagios-plugins-mrtg.x86_64 : Nagios Plugin – check_mrtg
nagios-plugins-mrtgtraf.x86_64 : Nagios Plugin – check_mrtgtraf
nagios-plugins-mysql.x86_64 : Nagios Plugin – check_mysql
nagios-plugins-nagios.x86_64 : Nagios Plugin – check_nagios
nagios-plugins-nrpe.x86_64 : Provides nrpe plugin for Nagios
nagios-plugins-nt.x86_64 : Nagios Plugin – check_nt
nagios-plugins-ntp.x86_64 : Nagios Plugin – check_ntp
nagios-plugins-nwstat.x86_64 : Nagios Plugin – check_nwstat
nagios-plugins-openmanage.x86_64 : Nagios plugin to monitor hardware health on Dell servers
nagios-plugins-oracle.x86_64 : Nagios Plugin – check_oracle
nagios-plugins-overcr.x86_64 : Nagios Plugin – check_overcr
nagios-plugins-perl.x86_64 : Nagios plugins perl dep.
nagios-plugins-pgsql.x86_64 : Nagios Plugin – check_pgsql
nagios-plugins-ping.x86_64 : Nagios Plugin – check_ping
nagios-plugins-procs.x86_64 : Nagios Plugin – check_procs
nagios-plugins-radius.x86_64 : Nagios Plugin – check_radius
nagios-plugins-real.x86_64 : Nagios Plugin – check_real
nagios-plugins-rhev.noarch : Nagios Plugin – check_rhev
nagios-plugins-rpc.x86_64 : Nagios Plugin – check_rpc
nagios-plugins-sensors.x86_64 : Nagios Plugin – check_sensors
nagios-plugins-smtp.x86_64 : Nagios Plugin – check_smtp
nagios-plugins-snmp.x86_64 : Nagios Plugin – check_snmp
nagios-plugins-ssh.x86_64 : Nagios Plugin – check_ssh
nagios-plugins-swap.x86_64 : Nagios Plugin – check_swap
nagios-plugins-tcp.x86_64 : Nagios Plugin – check_tcp
nagios-plugins-time.x86_64 : Nagios Plugin – check_time
nagios-plugins-ups.x86_64 : Nagios Plugin – check_ups
nagios-plugins-users.x86_64 : Nagios Plugin – check_users
nagios-plugins-wave.x86_64 : Nagios Plugin – check_wave
perl-Nagios-NSCA.noarch : Nagios::NSCA Perl module
perl-Nagios-Plugin.noarch : Family of perl modules to streamline writing Nagios plugins
perl-Nagios-Plugin-WWW-Mechanize.noarch : Login to a web page as a user and get data as a Nagios plugin
pnp4nagios.x86_64 : Nagios performance data analysis tool
ndoutils.x86_64 : Stores all configuration and event data from Nagios in a database
nrpe.x86_64 : Host/service/network monitoring agent for Nagios
nsca.x86_64 : Nagios Service Check Acceptor

From the output we see there is alot to choose from. For the basic monitoring we will want nrpe, nagios-plugins-disk,

nagios-plugins

# yum install nrpe nagios-plugins nagios-plugins-load nagios-plugins-disk nagios-plugins-procs nagios-plugins-users

==================================================================================================
Package                    Arch               Version                     Repository        Size
==================================================================================================
Installing:
nagios-plugins             x86_64             1.4.15-2.el6                epel             186 k
nrpe                       x86_64             2.12-16.el6                 epel             219 k
nagios-plugins-disk        x86_64             1.4.15-2.el6                epel             67 k
nagios-plugins-load        x86_64             1.4.15-2.el6                epel             29 k
nagios-plugins-procs       x86_64             1.4.15-2.el6                epel             66 k
nagios-plugins-users       x86_64             1.4.15-2.el6                epel             28 k

Installing for dependencies:
nagios-common              x86_64             3.3.1-3.el6                 epel              16 k

Plugins will be located here
# ls /usr/lib64/nagios/plugins/
check_disk  check_load  check_procs  check_users  negate  urlize  utils.sh

Edit nrpe config at /etc/nagios/nrpe.cfg
Change the allowed hosts to your server.

Add port 5666 to etc/services
# vi /etc/services
nrpe 5666/tcp # NRPE

Restart nrpe to accept the changes

If you want to compile and download them and not use epel you can download and compile

Create the Nagios user and set the password.
# useradd nagios
# passwd nagios

nagios-plugins-1.4.15.tar.gz
# tar xzf nagios-plugins-1.4.15.tar.gz
# ./configure –with-nagios-user=nagios –with-nagios-group=nagios
# make
# make install

tar -xzvf nrpe-2.12.tar.gz
./configure
make
make install

Add port 5666 to etc/services
# vi /etc/services
nrpe 5666/tcp # NRPE

Test NRPE Daemon Install

Check NRPE daemon is running and listening on port 5666:
# netstat -at |grep nrpe

Output should be NRPE version:
NRPE v2.12

Windows

There are several clients available out there for Windows systems to talk to Nagios servers. The most popular is NSclient++. This client is a favorite because it can do alot and talk to the many different interfaces of Nagios. NSClient++ can be found at http://www.nsclient.org/.

Download NSClient++ 0.3.9 (stable) from http://www.nsclient.org/nscp/downloads. Download the 32 or 64 bit msi package
At this point you can double-click and run the installation or use the unattended install which is my preference, especially for large and silent deployments, the syntax is:

msiexec /i <MSI FILE> /quiet

ex: msiexec /i NSClient++-0.3.9-x64.msi /quiet

This command will install all the features and reboot the server. If this is ok for your situation then you are on your way.

Quiet install without restart and with all features but the firewall exception:

msiexec /i <<<MSI FILE>>> /quiet /norestart ADDLOCAL=ALL REMOVE=”FireWallException”

Passive install (displays progress bar) without restart and with several feature exceptions:

msiexec /i <<<MSI FILE>>> /passive /norestart ADDLOCAL=”ALL” REMOVE=”Documentation,NSCPlugins,NSCAPlugin,SampleScripts”

Solaris 10

Add “nagios” user as “/usr/local/nagios” as home directory.
# useradd -c “Nagios User” -d /usr/local/nagios -m nagios

Change ownership of directory to nagios
# chown nagios:nagios /usr/local/nagios/

download nagios-plugins and nrpe from net.
# mkdir /nagios; cd /nagios
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz

Now extract them

# gunzip nagios-plugins-1.4.15.tar.gz; gunzip nrpe-2.13.tar.gz

# tar xvf nagios-plugins-1.4.15.tar.gz; tar xvf nrpe-2.13.tar.gz

Before compiling I had to set PATH to find gcc binary,

# export PATH=$PATH:/usr/sfw/sbin:/usr/sfw/bin:/usr/ccs/bin

# cd nagios-plugins-1.4.15;

# ./configure –without-mysql (I did want to install with mysql support)
# make; make install
# chown -R nagios:nagios /usr/local/nagios/libexec

Install NRPE with SSL library support otherwise you will get error while compilation like this,

“checking for SSL headers… configure: error: Cannot find ssl headers”

# cd nrpe-2.13; ./configure –with-ssl=/usr/sfw/ –with-ssl-lib=/usr/sfw/lib/ –with-ssl-inc=/usr/sfw/include

Still if you compilation fails please apply these faqs/solutions given in nagios faqs.

http://www.nagios.org/faqs/index.php?section_id=4&expand=false&showdesc=true

In my case I had to make changes in src/nrpe.c for encryption. Do make all, make install to create respective binaries.

# make all; make install; make install-daemon-config;

Add following line at the end of /etc/services

nrpe 5666/tcp # NRPE

Also add this line to /etc/inetd.conf and convert it into SMF and enable service with -e option. Also checkout whether it went online.

nrpe stream tcp nowait nagios /usr/sfw/sbin/tcpd /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -i

# inetconv; inetconv -e

# svcs | grep nrpe

Make sure that your /etc/hosts.allow and /etc/hosts.deny does not block your nagios server. Here are the entries

hosts.allow: nrpe: 127.0.0.1, 192.168.1.85

hosts.deny: nrpe: ALL

Final command, make sure that nrpe returns correct output.

# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.13

Add “nagios” user as “/usr/local/nagios” as home directory.

# useradd -c “Nagios User” -d /usr/local/nagios -m nagios

Change ownership of directory to nagios

# chown nagios:nagios /usr/local/nagios/

download nagios-plugins and nrpe from net. I have download them from sourceforge.

# mkdir /nagios; cd /nagios

wget http://sourceforge.net/project/downloading.php?group_id=29880&filename=nagios-plugins-1.4.15.tar.gz

wget http://sourceforge.net/project/downloading.php?group_id=26589&filename=nrpe-2.13.tar.gz

Now extract them

# gunzip nagios-plugins-1.4.15.tar.gz; gunzip nrpe-2.13.tar.gz

# tar xvf nagios-plugins-1.4.15.tar.gz; tar xvf nrpe-2.13.tar.gz

Before compiling I had to set PATH to find gcc binary,

# export PATH=$PATH:/usr/sfw/sbin:/usr/sfw/bin:/usr/ccs/bin

# cd nagios-plugins-1.4.15;

# ./configure –without-mysql (I did want to install with mysql support)
# make; make install
# chown -R nagios:nagios /usr/local/nagios/libexec

Install NRPE with SSL library support otherwise you will get error while compilation like this,

“checking for SSL headers… configure: error: Cannot find ssl headers”

If you run “dmesg” or if you check system messages you can see this error.

feb 26 17:08:23 solaris10.remotehost.com inetd[24233]: [ID 702911 daemon.error] Failed to set credentials for the inetd_start method of instance svc:/network/nrpe/tcp:default (chdir: No such file or directory)
Feb 26 17:15:24 solaris10.remotehost.com inetd[24241]: [ID 702911 daemon.error] Failed to set credentials for the inetd_start method of instance svc:/network/nrpe/tcp:default (chdir: No such file or directory)

# cd nrpe-2.13; ./configure –with-ssl=/usr/sfw/ –with-ssl-lib=/usr/sfw/lib/ –with-ssl-inc=/usr/sfw/include

Still if you compilation fails please apply these faqs/solutions given in nagios faqs.

http://www.nagios.org/faqs/index.php?section_id=4&expand=false&showdesc=true

In my case I had to make changes in src/nrpe.c for encryption. Do make all, make install to create respective binaries.

# make all; make install; make install-daemon-config;

Add following line at the end of /etc/services

nrpe 5666/tcp # NRPE

Also add this line to /etc/inetd.conf and convert it into SMF and enable service with -e option. Also checkout whether it went online.

nrpe stream tcp nowait nagios /usr/sfw/sbin/tcpd /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -i

# inetconv; inetconv -e

# svcs | grep nrpe

Make sure that your /etc/hosts.allow and /etc/hosts.deny does not block your nagios server. Here are the entries

hosts.allow: nrpe: 127.0.0.1, 192.168.1.85

hosts.deny: nrpe: ALL

Final command, make sure that nrpe returns correct output.

# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12

Now that we have running agents you will need to create monitors, host and hostgroups in Nagios to start monitoring the servers. Look for Part 3 of the series coming soon.

 

2 Responses to “Installing Nagios Part 2 – The Agents”

  1. lor says:

    On what machine will i install “the agent” ? on the same machine where i installed Nagios server?

    • newlife007 says:

      The agents are installed on the servers you want to monitor, once the agents are installed you create the monitors, and all the systems groups, times to monitor and all the other components to Nagios. Part 3 is coming soon with how to configure and start monitoring and alerting.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top