12345678910111213141516171819202122 |
- #!/bin/python3
- #
- import sys
-
-
- class Nagios(object):
- OK = 0
- WARNING = 1
- ERROR = 2
- UNKNOWN = 3
- STATUS_DICT = {
- OK: 'OK',
- WARNING: 'WARNING',
- ERROR: 'ERROR',
- UNKNOWN: 'UNKNOWN'
- }
-
- def exit(self, status=UNKNOWN, msg="No Monitoring implemented."):
- if status not in self.STATUS_DICT:
- status = self.UNKNOWN
- print(f"{self.STATUS_DICT[status]} - {msg}")
- sys.exit(status)
|