Initial Nagios helper library
This commit is contained in:
parent
ccbdff7f59
commit
3d7f2eca05
22
__init__.py
Normal file
22
__init__.py
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user