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

4

16

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.

Darwen answered 14/10, 2011 at 13:19 Comment(0)
B
15

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.

Barling answered 10/7, 2014 at 9:11 Comment(0)
Z
8

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
Zooplankton answered 28/10, 2013 at 16:4 Comment(1)
MK Livestatus said that several others also supports their API. One, Thuk, is on Github and looks nice and possibly requires fewer installations items. (I might be wrong about that, but MK seems to need a DB.) thruk.org/documentation.html#_reasons_to_choose_thrukJube
O
7

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.

Odellodella answered 20/10, 2011 at 7:38 Comment(6)
I think you should be able to post the remaining links as comments to your answer. Once you have more reputation you can edit your answer and put the links where you wanted them to put in the first place. That way your information is still in one place.Prothorax
yep, but NagiosWS and GrowndWork Foundation are tricky one ) for example #7837855Odellodella
So for me this only 3 real way - Livestatus(supported at least), status-json(uses status.cgi as source and this is no good) and IDOutils, which store your data into DB. It's cool and useful but no feedback to Nagios but you can use Nagios commandline API. But this way is to low level for web service and require some work.Odellodella
Thanks for the useful suggestions, @ainlolcat! Bet you can post more links now lolDarwen
yep. I think so. Thank you. About Nagios - try Icinga it's really great)Odellodella
I'm trying to compile status-json but it just won't work. I need some experience for compiling it just standalone. Anyone?Paderna
S
2

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.

Soandso answered 22/2, 2016 at 11:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.