<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=Nagios</id>
	<title>Nagios - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=Nagios"/>
	<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=Nagios&amp;action=history"/>
	<updated>2026-04-20T15:40:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://t2bwiki.iihe.ac.be/index.php?title=Nagios&amp;diff=184&amp;oldid=prev</id>
		<title>Maintenance script: Created page with &quot; == Nagios Monitoring == PageOutline *On this page you&#039;ll find all information on the Nagios instance to monitor the T2_BE_IIHE  *The webpage of Nagios can be found [h...&quot;</title>
		<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=Nagios&amp;diff=184&amp;oldid=prev"/>
		<updated>2015-08-26T12:28:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; == Nagios Monitoring == &lt;a href=&quot;/index.php?title=PageOutline&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;PageOutline (page does not exist)&quot;&gt;PageOutline&lt;/a&gt; *On this page you&amp;#039;ll find all information on the Nagios instance to monitor the T2_BE_IIHE  *The webpage of Nagios can be found [h...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Nagios Monitoring ==&lt;br /&gt;
[[PageOutline]]&lt;br /&gt;
*On this page you&amp;#039;ll find all information on the Nagios instance to monitor the T2_BE_IIHE&lt;br /&gt;
&lt;br /&gt;
*The webpage of Nagios can be found [http://www.nagios.org/ here].&lt;br /&gt;
*The freely available Nagios is named &amp;#039;&amp;#039;&amp;#039;Nagios Core&amp;#039;&amp;#039;&amp;#039; and the full documentation is found [http://www.nagios.org/documentation here]&lt;br /&gt;
&lt;br /&gt;
=== Quick link section ===&lt;br /&gt;
&lt;br /&gt;
*The web interface of &amp;#039;&amp;#039;&amp;#039;our&amp;#039;&amp;#039;&amp;#039; Nagios can be found on [http://egon.iihe.ac.be/nagios http://egon.iihe.ac.be/nagios]. &lt;br /&gt;
**On this page the current status of the site can be monitored as well as the event logs&lt;br /&gt;
**It is possible to reschedule a Nagios check from this web interface: [[HOWTORestartNagiosTest| HOWTO restart a nagios test manually]] &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username: nagiosadmin&lt;br /&gt;
passwd: ****&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The dutch grid infrastructure provides us with test of various GRID aspects.&lt;br /&gt;
**https://sam-ngi.grid.sara.nl/nagios/&lt;br /&gt;
**More info about the tests that are run against our site:&lt;br /&gt;
**https://tomtools.cern.ch/confluence/display/SAMDOC/Grid+probes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
==== Installation by Quattor ====&lt;br /&gt;
&lt;br /&gt;
==== Nagios server ====&lt;br /&gt;
&lt;br /&gt;
*Nagios is installed on egon.iihe.ac.be&lt;br /&gt;
**It is based on a Quattor base machine&lt;br /&gt;
**It is a virtual machine running on dom05.wn.iihe.ac.be&lt;br /&gt;
*A template nagios.tpl is available including the rpms needed for deploying a nagios server.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cfg/sites/iihe-production/config/nagios.tpl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Some of these rpms are added to the begrid repository since they were missing. A procedure how to do this is described here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
https://mon.iihe.ac.be/trac/t2b/wiki/GridAdminSurvivalGuide&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*This template has never been used to install a brand new server. So in case of troubles have a look at the &amp;#039;&amp;#039;installation by hand&amp;#039;&amp;#039;, which was used the first time egon was installed.&lt;br /&gt;
&lt;br /&gt;
==== Nagios client ====&lt;br /&gt;
&lt;br /&gt;
*The same template as the nagios server takes care of the rpms but excludes eg. apache, nagios core,...&lt;br /&gt;
*In this template the &amp;#039;&amp;#039;nrpe_commands.cfg&amp;#039;&amp;#039; file is created with filecopy. This file is needed to make sure the commands to execute remote scripts are distributed to all machines.&lt;br /&gt;
&lt;br /&gt;
==== Installation by hand ====&lt;br /&gt;
&lt;br /&gt;
*[[Nagios_installation| How to]] install a nagios server by hand on egon&lt;br /&gt;
*[[Nagios_installation| How to]] install a nagios server by hand on an Ubuntu desktop. This was tested on a laptop and was found to work&lt;br /&gt;
*Tutorial for installation and configuration: http://wiki.centos.org/HowTos/Nagios&lt;br /&gt;
*Tutorial for installation: http://docs.cslabs.clarkson.edu/wiki/Install_Nagios_on_CentOS_5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
*On egon the nagios configuration is done in &amp;#039;&amp;#039;/etc/nagios&amp;#039;&amp;#039;&lt;br /&gt;
*One config file is steering the whole nagios instance &amp;#039;&amp;#039;/etc/nagios/nagios.cfg&amp;#039;&amp;#039;&lt;br /&gt;
**It includes the object configuration files to define the hosts, services, contacts,...&lt;br /&gt;
&lt;br /&gt;
*After changing the configuration files one needs to restart the nagios daemon. It is useful to test first if the configuration doesn&amp;#039;t contain bugs.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nagios -v /etc/nagios/nagios.cfg &lt;br /&gt;
/etc/init.d/nagios restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*[http://www.linux.com/archive/feature/113803 Introduction to Nagios]: Tutorial with a detailed explanation of config files&lt;br /&gt;
*[http://www.debian-administration.org/articles/299 Tutorial for configuration]: Tutorial for configuration &lt;br /&gt;
&lt;br /&gt;
==== Hosts ====&lt;br /&gt;
&lt;br /&gt;
*The hosts.cfg file is made based on databases.tpl using a little script&lt;br /&gt;
&lt;br /&gt;
*The script can be found here&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/etc/nagios/scripts/makedb.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**As soon as new machines are added to databases.tpl this file needs to be copied from ccq to egon&lt;br /&gt;
**When running the script a temporary file &amp;#039;&amp;#039;serverdb&amp;#039;&amp;#039; is made that contains a list of hostname and ip-address&lt;br /&gt;
**Based on the configuration file &amp;#039;&amp;#039;makedb.cfg&amp;#039;&amp;#039; a number of hosts are excluded from being put in hosts.cfg&lt;br /&gt;
**The script contains some hardcoded servers and has the hostgroups hardcoded as well&lt;br /&gt;
**When the script is finished, don&amp;#039;t forget to copy hosts.cfg to the objects directory (and make a backup of the previous file so you can see the changes)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
==== Services ====&lt;br /&gt;
&lt;br /&gt;
*The services.cfg file contains a definition of all checks (services) executed by nagios.&lt;br /&gt;
**The definition of the services include a link to a plugin (script) that will actually perform the check. eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
check_command			check_tcp1500225&lt;br /&gt;
check_command			check_nrpecheck_mem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**The first one is a script that will run on egon. The definition of check_tcp can be found in &amp;#039;&amp;#039;commands.cfg&amp;#039;&amp;#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;#039;check_tcp&amp;#039; command definition&lt;br /&gt;
define command{&lt;br /&gt;
	command_name	check_tcp&lt;br /&gt;
	command_line	$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**Where $USER1$ is on egon&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/lib64/nagios/plugins&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**The second one is a more complex case. The test will execute a script over NRPE&lt;br /&gt;
**Nagios is using [http://egon.iihe.ac.be/nagios/docs/addons.html#nrpe NRPE] (Nagios Remote Plugin Executor) to actively monitor services on client hosts. &lt;br /&gt;
***a list of plugins can be found [http://exchange.nagios.org/directory/Plugins here] and [http://nagiosplugins.org/ here].&lt;br /&gt;
***More info on NRPE: http://nagios.sourceforge.net/docs/3_0/addons.html&lt;br /&gt;
***More info on NRPE: http://www.thegeekstuff.com/2008/06/how-to-monitor-remote-linux-host-using-nagios-30/&lt;br /&gt;
***More info on NRPE: http://markmail.org/message/uwzrxhugtusi7i5w#query:+page:1+mid:hzqla7ciu5xvxo4q+state:results&lt;br /&gt;
**The NRPE script will take as argument a script that is available on the client host.&lt;br /&gt;
**The definition of check_mem can be found in &amp;#039;&amp;#039;/etc/nagios/nrpe_commands.cfg&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command[check_mem]=/usr/lib64/nagios/plugins/check_mem 85 95&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
**&amp;#039;&amp;#039;&amp;#039;IMPORTANT:&amp;#039;&amp;#039;&amp;#039; the &amp;#039;&amp;#039;/etc/nagios/nrpe_commands.cfg&amp;#039;&amp;#039; file is managed by Quattor since it has to be available on all hosts&lt;br /&gt;
**Since the Nagios NRPE functionality is basically executing scripts this can be run on the command line for testing purposes, eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/local/nagios/libexec/check_nrpe -H m4.iihe.ac.be -c check_nfsstat_access&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
**Based on the output of the plugin (OK/Warning/Critical/Unknown a mail can be send, or other actions can be performed)&lt;br /&gt;
&lt;br /&gt;
**Some of the nagios plugins are home-brew and are distributed on all the machines with an RPM using Quattor. &lt;br /&gt;
**Specific info on the nagios plugins can be found [[NagiosNRPE| here]]&lt;br /&gt;
**HOWTO pack the RPM is explained here [[NagiosPlugins| here]]&lt;br /&gt;
**Since the RPMs are distributed via Quattor and some script need sudo priviliges, Quattor will also take care of this.&lt;br /&gt;
&lt;br /&gt;
**Nagios is able to perform an action in case a state changes, this is called event handlers, more info on the local implementation can be found [[NagiosEventHandles| here]]&lt;br /&gt;
&lt;br /&gt;
==== Contacts ====&lt;br /&gt;
&lt;br /&gt;
*contacts.cfg together with contactgroups.cfg defines the contact persons and when/whatfor they will be contacted.&lt;br /&gt;
*Only a few contact persons are created.&lt;br /&gt;
*Two groups exist: &lt;br /&gt;
**One to send mails to all admins&lt;br /&gt;
**One for testing newly added checks &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Extensions ===&lt;br /&gt;
&lt;br /&gt;
*[http://www.ibm.com/developerworks/linux/library/l-ganglia-nagios-1/ Nagios and Ganglia]: Tutorial explaining how to interface ganglia in Nagios&lt;br /&gt;
&lt;br /&gt;
==== Installation of PNP4NAGIOS by hand on egon ====&lt;br /&gt;
&lt;br /&gt;
*The full documentation is here http://docs.pnp4nagios.org/pnp-0.4/start&lt;br /&gt;
*I&amp;#039;ve downloaded version 0.6.11, which is the latest (17/03/2011)&lt;br /&gt;
*RRDtool is needed; get it from sourceforge repo&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm&lt;br /&gt;
rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm&lt;br /&gt;
yum install rrdtool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*The configuration was done by executing&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*There is a misconfiguration in /etc/httpd/conf.d/pnp4nagios.conf, make sure this line is set:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AuthUserFile /etc/nagios/htpasswd.users&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Once the webpage http://egon.iihe.ac.be/pnp4nagios/ is accessible I still needed to get&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install php-gd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*In the the commands.cfg file the processing of the perfdata needs to be set correclty&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/etc/nagios/libexec/process_perfdata.pl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*The first installation was done in /etc but this is not the appropriate place. Now the configuration is done with option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./configure --with-perfdata-dir=/var/nagios/perfdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   resulting in&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*** Configuration summary for pnp4nagios-0.6.11 01-15-2011 ***&lt;br /&gt;
&lt;br /&gt;
  General Options:&lt;br /&gt;
  -------------------------         -------------------&lt;br /&gt;
  Nagios user/group:                nagios nagios&lt;br /&gt;
  Install directory:                /usr/local/pnp4nagios&lt;br /&gt;
  HTML Dir:                         /usr/local/pnp4nagios/share&lt;br /&gt;
  Config Dir:                       /usr/local/pnp4nagios/etc&lt;br /&gt;
  Location of rrdtool binary:       /usr/bin/rrdtool Version 1.4.4&lt;br /&gt;
  RRDs Perl Modules:                FOUND (Version 1.4004)&lt;br /&gt;
  RRD Files stored in:              /var/nagios/perfdata&lt;br /&gt;
  process_perfdata.pl Logfile:      /usr/local/pnp4nagios/var/perfdata.log&lt;br /&gt;
  Perfdata files (NPCD) stored in:  /usr/local/pnp4nagios/var/spool&lt;br /&gt;
&lt;br /&gt;
  Web Interface Options:  -------------------------         -------------------&lt;br /&gt;
  HTML URL:                         http://localhost/pnp4nagios&lt;br /&gt;
  Apache Config File:               /etc/httpd/conf.d/pnp4nagios.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Backup ===&lt;br /&gt;
&lt;br /&gt;
*A daily backup of the nagios configuration is made&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/etc/cron.daily/backup_nagios.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*The tarball is copied to jefke&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/userbackup/backup_egon_nagios/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TracNotice|{{PAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>