zorkian / nagios-api

A REST-like, JSON interface to Nagios
BSD 3-Clause "New" or "Revised" License
586 stars 173 forks source link

Extended output with data from configuration #6

Closed davbo closed 8 years ago

davbo commented 12 years ago

Using this pull request to make me finish this stuff up. So far I've added a couple of views for service and host groups.

Any more stuff to get this merged?

zorkian commented 12 years ago

On the code -- looks good. I will pull this down and test it on my deployment and make sure it works with my stack and see how it goes. Do you want me to hold off on merging for now? I don't know what your timeframe is on the questions below.

1) Status changes frequently, but configuration probably doesn't. Does Nagios give (via status?) some sort of "config last updated" timer? Also, of note, Nagios doesn't re-read the config until it restarts. So perhaps we shouldn't either? Is there any value to reloading the config when the state-of-the-world hasn't changed?

Of course, that leaves us in a weird situation where nagios-api could restart and Nagios is still old, so we pick up new config changes and Nagios doesn't have them... maybe that means we should refresh the config frequently so that it's a known thing rather than a surprise?

2) Can't think of anything else to read from them now. I don't think I want this to be a generic "edit and view my Nagios config" system. Just what you need to build dashboards and control it -- so hosts/services/hostgroups/servicegroups is great.

3) I'm a fan of graceful degradation in tools that are close to the monitoring heart of the world. If the config can't be parsed, those methods should return error messages indicating what is going on -- an appropriate HTTP status code + a message. Also, it should be logged to output so you can see it in the daemon logs.

davbo commented 12 years ago

I was hoping to have some time to work on this. But it looks like my team won't be working on our status project for a few more weeks. So it will just be any time I get outside of work (perhaps not so much...) fwiw we knocked together this dashboard using the API - http://schroedinger.oucs.ox.ac.uk:8000

Thinking aloud.. Perhaps we could watch the pid of nagios to look for a restart there and reload the config files only once we see this?

Agree on the graceful degradation, if I have any more time on this that will be what I look at doing first. I'm not 100% sure what behaviour I expect if there are problems parsing at the moment.

I think if it's working on your system and we get the graceful degradation stuff working well then it's good to merge?

zorkian commented 8 years ago

Closing stale pull request. If you want to pick this up again LMK!