diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..3ffac6f --- /dev/null +++ b/__init__.py @@ -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)