Open ftobia opened 10 years ago
I would like for a health check command (both nose and pytest) to be able to generate output that can be consumed by nagios.
I agree with the idea that integration with Nagios should be easy (and documented). But at the moment, I do not know how this could be achieved. So, it is a bit hard for me to answer...
Is pytest and nose output made to be consumed by nagios? Is it easy to alter nose or pytest output for nagios?
If the feature request is about "Nagios can run and consume healthchecks", then is it limited to nose and pytest?
Perhaps one should try to integrate hospital with nagios, and tell us about it and how to improve it.
Of course, if there is a nice solution for pytest/nose, it is welcome ;)
But perhaps it would be easier using the web service (hospital-serve or WSGI application), since it returns 200/500 status code and structured output (currently json).
Using a special command for nagios is also an option. Something like hospital-nagios
?
Any pull request would be welcome: we can start with some prototype and, later, improve it.
I have an idea for this that is sort of related to #34 and #22 This implementation idea can be independent of nagios support. I saw your other tickets about ways of handling multiple warnings and thought I'd weigh in.
Yes, about warnings, let's implement #22 first. At the moment, I am not sure about the implementation of both features. So I really cannot guess how nagios will be able to consume warnings.
I would like for a health check command (both nose and pytest) to be able to generate output that can be consumed by nagios.
I am not an expert on nagios, but basically there will be: 1) a return code (0 for OK, 1 for WARNING, 2 for CRITICAL) 2) standard output's first line is one of "OK", "WARNING", "CRITICAL". 3) optional long output to follow the first line.
Here is a web page that describes the output: http://nagios.sourceforge.net/docs/3_0/pluginapi.html
I have an idea for this that is sort of related to #34 and #22. Allow health checks to raise exceptions for
Warning
andCritical
, which are both subclasses ofAssertionError
. Customize the test runners to aggregate the different types of exceptions raised, which they will use to customize the output. In this way, multiple WARNINGS would still yield an output of WARNING, but one CRITICAL plus multiple WARNINGS would make the output be CRITICAL.The benefit of subclassing
AssertionError
is that the health checks should still behave the same way when they're run with normal test collectors.This implementation idea can be independent of nagios support. I saw your other tickets about ways of handling multiple warnings and thought I'd weigh in.