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?

Joachim Breitner
  • 3,469
  • 3
  • 17
  • 20
  • 1
    http://serverfault.com/questions/549101/get-full-list-of-host-and-services-from-nagios/549174 – Keith Dec 31 '13 at 18:29

2 Answers2

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.

cixelsyd
  • 291
  • 1
  • 4
  • 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 01 '14 at 01: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