Module: check_mk
Branch: master
Commit: f662612f45fc71a40579d42aafbd1a54531e1321
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f662612f45fc71…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jul 30 11:30:07 2015 +0200
#2490 FIX synology_disks: treat SSDs with state "not initialized" as OK if state
does not change later
---
.werks/2490 | 9 +++++++++
ChangeLog | 1 +
checkman/synology_disks | 7 +++++--
checks/synology_disks | 38 ++++++++++++++++++++++++++------------
4 files changed, 41 insertions(+), 14 deletions(-)
diff --git a/.werks/2490 b/.werks/2490
new file mode 100644
index 0000000..5d6dada
--- /dev/null
+++ b/.werks/2490
@@ -0,0 +1,9 @@
+Title: synology_disks: treat SSDs with state "not initialized" as OK if state
does not change later
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1438248573
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 9b348cc..fb0cf12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -91,6 +91,7 @@
* 1275 FIX: Fileinfo: Fixed handling of output from AIX Agent
* 2500 FIX: qlogic_fcport: Can now deal with missing port status information...
* 1276 FIX: brocade_mlx_temperature: Fixed the shown Temperature Values
+ * 2490 FIX: synology_disks: treat SSDs with state "not initialized" as OK
if state does not change later
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/checkman/synology_disks b/checkman/synology_disks
index ff5171d..96d4e09 100644
--- a/checkman/synology_disks
+++ b/checkman/synology_disks
@@ -4,12 +4,15 @@ catalog: hw/storagehw/synology
license: GPL
distribution: check_mk
description:
- This check monitors the health and current Status of
- Hardisks attached to a Synology NAS device.
+ This check monitors the health and current status of
+ hardisks attached to a Synology NAS device.
The check returns an {CRIT} in case of an error state reported
by the device. The check also reports the model number and the
temperature for each disk.
+ SSDs that are found within the state {3} (not initialized) during recovery
+ are assumed to be cache disks and will always interprete state {3} as OK.
+
item:
The name of the disk like reported in the MIB
diff --git a/checks/synology_disks b/checks/synology_disks
index 1ade456..7ac46cb 100644
--- a/checks/synology_disks
+++ b/checks/synology_disks
@@ -25,25 +25,39 @@
# Boston, MA 02110-1301 USA.
def inventory_synology_disks(info):
- for line in info:
- yield line[0], None
+ for disk, model, status, temperature in info:
+ # SSD used as cache are "not initialized". We remember that
+ # here.
+ if "SSD" in model and status == '3':
+ params = { "used_as_cache" : True }
+ else:
+ params = {}
+
+ yield disk, params
+
-def check_synology_disks(item, _no_params, info):
+def check_synology_disks(item, params, info):
states = {
- 1 : ("OK", 0),
- 2 : ("OK", 0),
- 3 : ("not initialized", 1),
- 4 : ("system partition failed", 2),
- 5 : ("crashed", 2)
+ 1 : (0, "OK"),
+ 2 : (0, "OK"),
+ 3 : (1, "not initialized"),
+ 4 : (2, "system partition failed"),
+ 5 : (2, "crashed")
}
+
for disk, model, status, temperature in info:
if disk == item:
- state = int(status)
temp = int(temperature)
- message = "Status: %s, Temperature: %d °C, Model: %s" % \
- ( states[state][0], temp, model )
- return states[state][1], message, [("temp", temp )]
+ if status == '3' and params.get("used_as_cache"):
+ status_text = "used as cache"
+ status_code = 0
+ else:
+ status_code, status_text = states[int(status)]
+
+ message = "Status: %s, Temperature: %d °C, Model: %s" % (
status_text, temp, model )
+ return status_code, message, [("temp", temp )]
+
check_info["synology_disks"] = {
"check_function" : check_synology_disks,