nagios library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 458B

12345678910111213141516171819202122
  1. #!/bin/python3
  2. #
  3. import sys
  4. class Nagios(object):
  5. OK = 0
  6. WARNING = 1
  7. ERROR = 2
  8. UNKNOWN = 3
  9. STATUS_DICT = {
  10. OK: 'OK',
  11. WARNING: 'WARNING',
  12. ERROR: 'ERROR',
  13. UNKNOWN: 'UNKNOWN'
  14. }
  15. def exit(self, status=UNKNOWN, msg="No Monitoring implemented."):
  16. if status not in self.STATUS_DICT:
  17. status = self.UNKNOWN
  18. print(f"{self.STATUS_DICT[status]} - {msg}")
  19. sys.exit(status)