-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Is a more user friendly nagios exit function needed or not?
It can be cumbersome to import all exit function or all nagsio tuple constants. a more easy to use wrapper can solve this.
def nagios_exit(state, message):
"""Print message according to state: supported states:
- defined nagios constants NAGIOS_EXIT_
- string: OK,WARNING,CRITICAL and UNKNOWN
- integer: 0,1,2,3
"""
nagios_states = [NAGIOS_EXIT_OK, NAGIOS_EXIT_WARNING, NAGIOS_EXIT_CRITICAL, NAGIOS_EXIT_UNKNOWN]
for x in nagios_states:
if state == x or state == x[0] or state == x[1]:
# this exits, no break or return needed
_real_exit(message, x)
log.raiseException('Unsupported state %s.' % (state))
Metadata
Metadata
Assignees
Labels
No labels