nagfs

dave-nagios at homer.cymry.org dave-nagios at homer.cymry.org
Tue Apr 3 06:52:55 CEST 2007


Hiya.

nagfs is an event broker module, which implements a filesystem interface to the
current status of a running Nagios daemon. This means in a nutshell that you
can query the status of a given service or set of services using everyday shell
tools like find and grep.

Each host is represented as a directory in the filesystem. Each host directory
contains a file for each service nagios is monitoring on that host. Each file
contains a single number representing the state of that service.

For example, once nagfs is running, you can list all the services currently in
a critical state by typing:

grep -rl "2" /usr/share/nagios/status/local

The numbers are what you'd expect ( 0:OK, 1:Warning, 2:Critical, 3,Unknown). If
the service is in a soft state a "servicename.soft" file is created with the
soft state status number. Each host directory also contains a HOST file which
contains the current status of the host itself.

As a second example, you could get a list of all the services Nagios is checking with:

find /usr/share/nagios/status/local -type f

This is a handy thing, and much easier than scraping html for the same info.
nagfs registers for SERVICE_STATUS_DATA and HOST_STATUS_DATA updates from the
Nagios server, which means that the nagfs filesystem is immediately brought up
to date upon Nagios startup, and is always perfectly in sync with Nagios's
memory state. 

It's released under the BSD license. The tarball is available on nagios
exchange, and my blog http://www.skeptech.org

Nagfs was originally the brainchild of Jeremy Blosser, who implemented it as a
collection of shell scripts called via global event handlers. I found it so
useful, and became so attached to it that I eventually forgot it wasn't
actually part of the core Nagios package. I later re-implemented it as an event
broker module as an object lesson for the addison wesley nagios book I
authored, and refined it as part of a larger nagios clustering project called
"nagimesh", which is not yet complete. However, I find nagfs so indispensable
that I decided to release the source as a stand-alone NEB module, in the hope
that you may too someday forget the time you've already spent without it.

Check INSTALL in the tarball for installation instructions. It is assumed that
you have a working Nagios implementation which has been compiled with the
--enable-event-broker configure switch. I have several Nagios servers running
versions of Nagios from 2.0alpha1 to 2.8, and nagfs works with all of them, so
it ought to work for you if you haven't ventured into 3.0 territory yet. I
haven't taken a look at the 3.0 event broker code yet, so for all I know
it could work (if you try it and it works for you let me know).

Have fun! 

-dave josephsen. 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list