icinga2-checks/checker/nagios.py

18 lines
384 B
Python

# TODO: remove non STATE_ vars
UNKNOWN = STATE_UNKNOWN = -1
OK = STATE_OK = 0
WARNING = STATE_WARN = 1
CRITICAL = STATE_CRIT = 2
def state_to_txt(state: int) -> str:
if state == STATE_UNKNOWN:
return 'UNKNOWN'
elif state == STATE_OK:
return 'OK'
elif state == STATE_CRIT:
return 'CRITICAL'
elif state == STATE_WARN:
return 'WARNING'