4

I recently acquired a nice 7×11 LED display, and I want (among other stuff) display my nagios status on it. For that I need to query the status of my Nagios installation.

What is the appropriate way to get a status summary (e.g. number of non-OK services) from a remote Nagios server from, say, a perl script?

4

I maintain an extremely large nagios installation, and can say the absolute best method to do this is via the "livestatus" event broker:

http://mathias-kettner.de/checkmk_livestatus.html

Livestatus provides instant access to nagios status via a local or tcp socket and introduces almost zero additional CPU load on your monitoring server (but does have a memory footprint, of course). Simple integration with xinetd/unixcat allows it to be queried via the network. Output is in one of three formats: CSV, JSON and Python. Numerous configuration options are available, and it is stable enough for Production usage. The documentation is very good.

Additionally, livestatus enables other nagios add-ons, such as "MK Multisite", which aggregates the results from multiple nagios installations into a single GUI without the use of NSCA or passive service checks results, which require nagios configurations to be maintained on both worker and master servers.

|improve this answer|||||
  • Close, but it does not cover the remote aspect of my question. But I played with it, discovered check_mk Multisite, which produces all its reports also in JSON format – good enough. If you add that to the answer, I’ll accept it. – Joachim Breitner Jan 1 '14 at 1:41
1

As far as I know there is no nagios.com supported API for querying nagios status. There are quite a few different add-ons that will allow you do to this. Some are discussed in this question.

https://stackoverflow.com/questions/7768215/is-there-a-way-to-extract-data-from-nagios-as-if-it-was-a-web-service

You can query the cgi directly and "screen scrape" the returned html, but that is not a very robust solution. I have messed around a bit with this version of an api server, but have not put in it production.

https://github.com/xb95/nagios-api

|improve this answer|||||
  • Update; per the referenced SO post, "Nagios 4.x starting with version 4.4 now includes CGIs for JSON output." – AnneTheAgile Aug 2 '14 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.