icinga2-checks/checker/nagios.py

21 lines
443 B
Python

# TODO: remove non STATE_ vars
import sys
from checker import print_icinga2_check_status
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'