Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

nagfs

Rating
0 votes
Favoured:
0
Hits
98302
Files:
FileDescription
nagfs.tarnagfs.tar
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
nagfs is a Nagios event broker module which implements a filesystem interface to the current status of a running Nagios daemon.


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 also has a HOST file which contains the current status of the host itself.


for 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. If you would like to see it do something that it isn’t currently, feel free to drop me an email, or check out the source code, it should be pretty easy for a layman to modify.


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