Is there a way to extract data from Nagios as if it was a web service?

40.7k views Asked by At

My situation: I'm working on a web monitoring dashboard that assembles informations from different applications and sources and generate graphs, info graphics and reports.

The applications I'm trying to integrate are CACTI, Nagios, and other local private monitoring tools. I had no problem to integrate these applications, except for Nagios (I don't have much experience with it).

What I want to know is if there is a way to use Nagios as a Web Service, or something similar, so I can expose some of the informations and use it to generate my own reports on my dashboard application.

Is it possible to do that without any epic effort?

thanks for reading.

4

There are 4 answers

0
freb On BEST ANSWER

Nagios 4.x starting with version 4.4 now includes CGIs for JSON output. Installing the newest version of Nagios might be the easiest way to go.

See the announcement here.

Review the slides from Nagios World Conference 2013 here.

6
ainlolcat On

You can try:

1) MK Livestatus http://mathias-kettner.de/checkmk_livestatus.html it's not web service but it can give current data without any complicated action. All you need redirect this data.

2)status-json plugin http://exchange.nagios.org/directory/Addons/APIs/JSON/status-2Djson/details which return data in JSON format.

3)NagiosWS plugin but I wasn't able to get to work it yet. I think it can be done for Nagios 2.x

4)GroundWork Foundation plugin. I think I will try use it now.

I was able to get to work 1 and 2 solution now.

Otherwise you can use Icinga which can give you some JSON or XML output. Icinga is fork of Nagios and can be installed with saving all your nagios data and plugins. At least it written on Icinga's site =) They have some other solution like PHP lib.

Sorry, I cannot post only 2 link while I'm newbie on this site.

Best regards.

0
Guy Engel On

Worked for me - MK Livestatus http://mathias-kettner.de/checkmk_livestatus.html it's not web service but it can give current data without any complicated action. All you need redirect this data.

1
Lars Michelsen On

The Check_MK Multisite GUI (Web base GUI using MK Livestatus) offers a web service mode, where you can send queries/commands as URL parameters and get the response as JSON in the body.

The trick is: Create a view in the GUI, which fits your needs. Then extract the URL of that view and add the parameter output_format=json. Now you should have the output in a parsable format.

For example, this URL should give you a JSON list of all services:

check_mk/view.py?view_name=allservices&output_format=json