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.

marcio
  • 10,002
  • 11
  • 54
  • 83

4 Answers4

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.

freb
  • 1,151
  • 13
  • 28
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
  • 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.) http://www.thruk.org/documentation.html#_reasons_to_choose_thruk – AnneTheAgile Aug 02 '14 at 19:54
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.

ainlolcat
  • 544
  • 4
  • 15
  • 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. – sjngm Oct 21 '11 at 05:30
  • yep, but NagiosWS and GrowndWork Foundation are tricky one ) for example http://stackoverflow.com/questions/7837355/compile-nagiosws-with-nagios-3-3-1 – ainlolcat Oct 25 '11 at 19:01
  • 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. – ainlolcat Oct 25 '11 at 19:11
  • Thanks for the useful suggestions, @ainlolcat! Bet you can post more links now lol – marcio Oct 26 '11 at 18:00
  • yep. I think so. Thank you. About Nagios - try Icinga it's really great) – ainlolcat Oct 27 '11 at 17:42
  • I'm trying to compile status-json but it just won't work. I need some experience for compiling it just standalone. Anyone? – Injeniero Barsa Jun 20 '13 at 23:22
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.

Guy Engel
  • 2,436
  • 1
  • 17
  • 13