Initial Nagios helper library

This commit is contained in:
Dirk Alders 2023-11-25 14:27:13 +01:00
parent ccbdff7f59
commit 3d7f2eca05

22
__init__.py Normal file
View File

@ -0,0 +1,22 @@
#!/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)