Browse Source

borders and output for check_shelly improved

master
Dirk Alders 11 months ago
parent
commit
a0327db258
1 changed files with 10 additions and 10 deletions
  1. 10
    10
      check_shelly

+ 10
- 10
check_shelly View File

8
 
8
 
9
 CHECKS = ['wifi', 'mqtt', 'memory', 'filesystem', 'temperature']
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
 RAM_ERROR = .15
14
 RAM_ERROR = .15
15
 RAM_WARNING = .30
15
 RAM_WARNING = .30
17
 FS_ERROR = .15
17
 FS_ERROR = .15
18
 FS_WARNING = .30
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
 if __name__ == "__main__":
24
 if __name__ == "__main__":
47
             status = n.WARNING
47
             status = n.WARNING
48
         else:
48
         else:
49
             status = n.OK
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
     elif args.check == 'mqtt':
51
     elif args.check == 'mqtt':
52
         connected = data['mqtt']['connected']
52
         connected = data['mqtt']['connected']
53
         if not connected:
53
         if not connected:
59
         ram_total = data['ram_total']
59
         ram_total = data['ram_total']
60
         ram_free = data['ram_free']
60
         ram_free = data['ram_free']
61
         ram_left = ram_free / ram_total
61
         ram_left = ram_free / ram_total
62
-        if ram_left < RAM_ERROR:
62
+        if ram_left <= RAM_ERROR:
63
             status = n.ERROR
63
             status = n.ERROR
64
-        elif ram_left < RAM_WARNING:
64
+        elif ram_left <= RAM_WARNING:
65
             status = n.WARNING
65
             status = n.WARNING
66
         else:
66
         else:
67
             status = n.OK
67
             status = n.OK
70
         fs_size = data['fs_size']
70
         fs_size = data['fs_size']
71
         fs_free = data['fs_free']
71
         fs_free = data['fs_free']
72
         fs_left = fs_free / fs_size
72
         fs_left = fs_free / fs_size
73
-        if fs_left < FS_ERROR:
73
+        if fs_left <= FS_ERROR:
74
             status = n.ERROR
74
             status = n.ERROR
75
-        elif fs_left < FS_WARNING:
75
+        elif fs_left <= FS_WARNING:
76
             status = n.WARNING
76
             status = n.WARNING
77
         else:
77
         else:
78
             status = n.OK
78
             status = n.OK
89
             status = n.WARNING
89
             status = n.WARNING
90
         else:
90
         else:
91
             status = n.OK
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…
Cancel
Save