How to Set Up Nagios to monitor an EPICS network

From EPICSWIKI

HOWTO install and setup NAL (Nagios Alarm Handler) on Fedora Core 7


Here's how to install NAL using yum


NAGIOS INSTALLATION

=======

The default nagios installation can be done by doing like so

  1. yum -y install nagios

With that I've installed nagios.i386 0:2.9-1.fc7 version; this is the last stable version (the 3.0 is under development).

Optional, but recomended if you have enough disk space: install more Nagios plugins and addons.

  1. yum -y install nagios-plugins nagios-plugins-all

That is not necessary but should be useful if you use NAL like a regular NAGIOS server more than only NAL (to monitor EPICS PVs network).

Nagios Default Folder Locations

====================

By default Nagios yum installation, Nagios stores the following file location into your harddisk

   * /etc/nagios/ - Nagios configuration folder locations
   * /var/log/nagios/ - Nagios log and messages folder locations
   * /usr/share/nagios/ - Nagios, docs, sounds, and image folder locations
   * /usr/lib/nagios/cgi-bin/ - Nagios CGI folder location
   * /usr/bin - Nagios binaries
   * /etc/httpd/conf.d/ - Nagios Apache folder files
   * /etc/logrotate.d/nagios/ - Nagios log rotation file


Insert the EPICS Nagios Plugins

==============

Going to www.nagiosexchange.org ; using the "search" botton, look to "epics". You will find a project named "NAgios plugins for EPICS". Scroll down that page, click over "check_caget_dev_gw.sh". Download it and save into the /usr/lib/nagios/plugins/ Change the permission to check_caget_dev_gw.sh

> chmod +x check_caget_dev_gw.sh

now verify that is usable with:

> ./check_caget_dev_gw.sh --help

verfing using camonitor a PV, ie for me giacchinHost:aiExample

> camonitor giacchinHost:aiExample

if everithings is good, now discover which is the IP number (for me it was 192.168.0.47) of your linux box by

  1. ifconfig

and test the plugin with the follow command:

> ./check_caget_dev_gw.sh -pv giacchinHost:aiExample -H 192.168.0.47

if that reply correctly the status of your PV you can continue the installation.

Now install the EPICS logos images.

==============
  1. cd /usr/share/nagios/html/images/logos

download there the usr.share.nagios.html.images.logo.tar availabe at same place in nagiosexchange.org that contains : EPICSlogo.gd2 EPICSlogo.gif EPICSlogoSmall.gif


Save the original Nagios setup and replace it.

==============

Go to /etc folder and save the original setup

  1. tar cvf nagios.or.tar ./nagios/

download there the etc.nagios.tar available at same place at nagiosexchange.org

and restore the nagios folder with that:

  1. tar xvf ./etc.nagios.tar

Note: Now looking around the files into /etc/nagios and adjust that to meet your network setup requirements.

NAGIOS CONFIG VERIFICATION

==============

For sanity checking, make sure you verify Nagios config files. This can be done like so

  1. nagios -v /etc/nagios/nagios.cfg

The above command would show you for any erroneous lines frin Nagios config file.

HTTPD configuration

==============

Check the presence of line: "include conf.d/*.conf"

in /etc/httpd/conf/httpd.conf

Check the paths into the file : /etc/httpd/conf.d/nagios.conf

Make a file named .htaccess into /usr/lib/nagios/cgi-bin/ and /usr/share/nagios/html/ which will contains:

AuthName "Nagios Access" AuthType Basic AuthUserFile /etc/nagios/passwd require valid-user

Now create a nagios user with the following command:

  1. htpasswd -c /etc/nagios/passwd nagiosadmin


NAGIOS LINUX SERVICE

==============

Basically, at this point of basic Nagios configuration, restarting Nagios should be successful.

Reload your apache service together with your Nagios service like so

  1. service httpd restart
  2. service Nagios stop
  3. service Nagios start
  4. service Nagios status

Open your favourite web-browser on http://localhost/nagios/

login like "nagiosadmin", give your password and enjoy!


See my nagios screenshots in action:


NagiosServiceDetails


NagiosAlertHistogram

Theare a lot of other interesting feature that comes from free using NAGIOS, looking around you should find a lot yourself.

At this time Ralph Lange has realized a test to NAL at Bessy. A great aknowlegment to him, he has supported me since the idea of use Nagios born in my mind.

Thank you for your attention! Please, give me a your feedback, and fell free to drop me an email, I'll be happy to continue to work on this idea if someome is interested to use it.

Mauro.