1

I need to get a full list of hosts and services from Nagios, to make a decision table.

I think there is two methods, querying the Nagios CGI, and parsing the Nagios cfg files.

But... Nagios cfg files may not be standard and this could be a problem.

Anyone knows how do that?

Thanks in advance

2

You can scrape this out of the object cache file (the path of which can be found in nagios.cfg, typically located somewhere like /usr/local/nagios/var/ or /var/cache/nagios3/), or scrape it out of the HTML output from the CGI (which you can run via the command line), but why reinvent the wheel?

You might want to try pynag, as it's made for exactly this purpose. If Python isn't your style, there's also the API category on Nagios Exchange that has similar add-ons to expose this info in almost any format you can imagine.

1

I personally prefer MK Livestatus for this. You could also use NDOUtils to put this data in a database.

  • Another excellent choice – Keith Oct 28 '13 at 15:31

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.