Browse Source

Initial Nagios helper library

master
Dirk Alders 1 year ago
parent
commit
3d7f2eca05
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      __init__.py

+ 22
- 0
__init__.py View File

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

Loading…
Cancel
Save