Difference between revisions of "How to Set Up NAL (Nagios Alarm Handler) to monitor an EPICS network"

From EPICSWIKI
Line 8: Line 8:
The default nagios installation can be done by doing like so
The default nagios installation can be done by doing like so


# yum -y install nagios
root>'' 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).
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.
Optional, but recomended if you have enough disk space: install more Nagios plugins and addons.
# yum -y install nagios-plugins nagios-plugins-all
 
root> ''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).
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).
Line 33: Line 35:
'''Insert the EPICS Nagios Plugins'''
'''Insert the EPICS Nagios Plugins'''


Going to http://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
Going to http://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/
/usr/lib/nagios/plugins/
Change the permission to check_caget_dev_gw.sh
Change the permission to check_caget_dev_gw.sh


> chmod  +x check_caget_dev_gw.sh
root> ''chmod  +x check_caget_dev_gw.sh
''


now verify that is usable with:
now verify that is usable with:


> ./check_caget_dev_gw.sh --help
> ''./check_caget_dev_gw.sh --help''


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


> camonitor 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
if everithings is good, now discover which is the IP number (for me it was 192.168.0.47) of your linux box by


#ifconfig
root> ''ifconfig''


and test the plugin with the follow command:
and test the plugin with the follow command:


> ./check_caget_dev_gw.sh -pv giacchinHost:aiExample -H 192.168.0.47
> ''./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.
if that reply correctly the status of your PV you can continue the installation.
Line 60: Line 64:
'''Now install the EPICS logos images'''
'''Now install the EPICS logos images'''


# cd /usr/share/nagios/html/images/logos
> ''cd /usr/share/nagios/html/images/logos''


download there the usr.share.nagios.html.images.logo.tar availabe at same place in nagiosexchange.org
download there the usr.share.nagios.html.images.logo.tar availabe at same place in nagiosexchange.org
Line 70: Line 74:
Go to /etc folder and save the original setup
Go to /etc folder and save the original setup


# tar cvf nagios.or.tar ./nagios/
root> ''tar cvf nagios.or.tar ./nagios/''


download there the etc.nagios.tar available at same place at nagiosexchange.org
download there the etc.nagios.tar available at same place at nagiosexchange.org
Line 76: Line 80:
and restore the nagios folder with that:
and restore the nagios folder with that:


# tar xvf  ./etc.nagios.tar
root> ''tar xvf  ./etc.nagios.tar''


Note: Now looking around the files into /etc/nagios and adjust that to meet your network setup requirements.
Note: Now looking around the files into /etc/nagios and adjust that to meet your network setup requirements.
Line 85: Line 89:
For sanity checking, make sure you verify Nagios config files. This can be done like so
For sanity checking, make sure you verify Nagios config files. This can be done like so


# nagios -v /etc/nagios/nagios.cfg
root> ''nagios -v /etc/nagios/nagios.cfg
 
''
The above command would show you for any erroneous lines frin Nagios config file.
The above command would show you for any erroneous lines frin Nagios config file.


Line 107: Line 111:
Now create a nagios user with the following command:
Now create a nagios user with the following command:


#htpasswd -c /etc/nagios/passwd nagiosadmin
root> ''htpasswd -c /etc/nagios/passwd nagiosadmin
 
''


'''NAGIOS as a Linux service'''
'''NAGIOS as a Linux service'''
Line 116: Line 121:
Reload your apache service together with your Nagios service like so
Reload your apache service together with your Nagios service like so


# service httpd restart
root> ''service httpd restart''
# service Nagios stop
root> ''service Nagios stop''
# service Nagios start
root> ''service Nagios start''
# service Nagios status
root> ''service Nagios status''


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




See my nagios screenshots in action:
'''See my nagios screenshots in action:'''




NagiosServiceDetails


NagiosServiceDetails


[[Image:NagiosServicesDetail.jpg]]
[[Image:NagiosServicesDetail.jpg]]


NagiosAlertHistogram
NagiosAlertHistogram


[[Image:NagiosAlertHistogram.jpg]]
[[Image:NagiosAlertHistogram.jpg]]
----


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

Revision as of 06:50, 15 November 2007

Here's how to install NAL using yum on Fedora Core 7 Linux box

Nagios default installation

The default nagios installation can be done by doing like so

root> 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.

root> 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 http://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

root> 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

root> 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

> 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

root> 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:

root> tar xvf ./etc.nagios.tar

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


NAGIOS check configuration file

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

root> 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:

root> htpasswd -c /etc/nagios/passwd nagiosadmin


NAGIOS as a 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

root> service httpd restart root> service Nagios stop root> service Nagios start root> 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


NagiosServicesDetail.jpg


NagiosAlertHistogram


NagiosAlertHistogram.jpg



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.


--MauroGiacchini 00:40, 15 Nov 2007 (CST)