Skip to content

Commit a577129

Browse files
Tonkenfoamotl
authored andcommitted
functional raid status check
1 parent a8438c5 commit a577129

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎check_synology.py‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,19 @@ def exitCode():
147147
}
148148
raid_status = status_translation.get(raid_status_nr)
149149
raid_name = raid_name.replace(" ", "")
150-
if int(raid_status_nr) == (2 or 3 or 4 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20):
151-
if state != 'CRITICAL':
152-
state = 'WARNING'
153-
if int(raid_status_nr) == 12:
150+
151+
# All of those "non-Normal" RAID states should be signalled as WARNING.
152+
warning_states = [2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20]
153+
154+
# Both Degrade and Crashed should be signalled as CRITICAL.
155+
critical_states = [11, 12]
156+
157+
if int(raid_status_nr) in warning_states:
158+
state = 'WARNING'
159+
if int(raid_status_nr) in critical_states:
154160
state = 'CRITICAL'
155161
if int(raid_status_nr) == 21:
156-
if state != 'CRITICAL':
157-
state = 'UNKNOWN'
162+
state = 'UNKNOWN'
158163

159164
output += ' - ' + raid_name + ': Status: ' + raid_status
160165
print('%s%s ' % (state, output))

0 commit comments

Comments
 (0)