-
Notifications
You must be signed in to change notification settings - Fork 7
Description
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:
- a return code (0 for OK, 1 for WARNING, 2 for CRITICAL)
- standard output's first line is one of "OK", "WARNING", "CRITICAL".
- 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 and Critical, which are both subclasses of AssertionError. 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.