Sfoglia il codice sorgente

borders and output for check_shelly improved

master
Dirk Alders 11 mesi fa
parent
commit
a0327db258
1 ha cambiato i file con 10 aggiunte e 10 eliminazioni
  1. 10
    10
      check_shelly

+ 10
- 10
check_shelly Vedi File

@@ -8,8 +8,8 @@ import urllib.request
8 8
 
9 9
 CHECKS = ['wifi', 'mqtt', 'memory', 'filesystem', 'temperature']
10 10
 #
11
-WIFI_QUALITY_ERROR = -90
12
-WIFI_QUALITY_WARNING = -87
11
+WIFI_QUALITY_ERROR = -92
12
+WIFI_QUALITY_WARNING = -88
13 13
 #
14 14
 RAM_ERROR = .15
15 15
 RAM_WARNING = .30
@@ -17,8 +17,8 @@ RAM_WARNING = .30
17 17
 FS_ERROR = .15
18 18
 FS_WARNING = .30
19 19
 #
20
-TMP_WARNING = 50
21
-TMP_ERROR = 57
20
+TMP_WARNING = 55
21
+TMP_ERROR = 60
22 22
 #
23 23
 
24 24
 if __name__ == "__main__":
@@ -47,7 +47,7 @@ if __name__ == "__main__":
47 47
             status = n.WARNING
48 48
         else:
49 49
             status = n.OK
50
-        n.exit(status, f"connected: {connected} - quality: {quality} < {WIFI_QUALITY_WARNING} < {WIFI_QUALITY_ERROR}")
50
+        n.exit(status, f"connected: {connected} - quality: {quality} > {WIFI_QUALITY_WARNING} > {WIFI_QUALITY_ERROR}")
51 51
     elif args.check == 'mqtt':
52 52
         connected = data['mqtt']['connected']
53 53
         if not connected:
@@ -59,9 +59,9 @@ if __name__ == "__main__":
59 59
         ram_total = data['ram_total']
60 60
         ram_free = data['ram_free']
61 61
         ram_left = ram_free / ram_total
62
-        if ram_left < RAM_ERROR:
62
+        if ram_left <= RAM_ERROR:
63 63
             status = n.ERROR
64
-        elif ram_left < RAM_WARNING:
64
+        elif ram_left <= RAM_WARNING:
65 65
             status = n.WARNING
66 66
         else:
67 67
             status = n.OK
@@ -70,9 +70,9 @@ if __name__ == "__main__":
70 70
         fs_size = data['fs_size']
71 71
         fs_free = data['fs_free']
72 72
         fs_left = fs_free / fs_size
73
-        if fs_left < FS_ERROR:
73
+        if fs_left <= FS_ERROR:
74 74
             status = n.ERROR
75
-        elif fs_left < FS_WARNING:
75
+        elif fs_left <= FS_WARNING:
76 76
             status = n.WARNING
77 77
         else:
78 78
             status = n.OK
@@ -89,4 +89,4 @@ if __name__ == "__main__":
89 89
             status = n.WARNING
90 90
         else:
91 91
             status = n.OK
92
-        n.exit(status, f"temperature: {temperature}°C")
92
+        n.exit(status, f"temperature: {temperature}°C < {TMP_WARNING} < {TMP_ERROR}")

Loading…
Annulla
Salva