[checkmk-commits] Check_MK Git: check_mk: netapp_api_volumes:<br>

Andreas Boesl ab at mathias-kettner.de
Tue Apr 28 16:55:57 CEST 2015


Module: check_mk
Branch: master
Commit: db8d3a12d6ea80183c06f7ac0f4ead2da19da44e
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=db8d3a12d6ea80183c06f7ac0f4ead2da19da44e

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Tue Apr 28 16:55:17 2015 +0200

netapp_api_volumes:<br>
fixed misleading warning for offline volumes, now also reports inode information

netapp_api_disks:<br>
reformatted check output, fixed incorrect disk numbers, data and parity disk now have a separate prefailed information.

Conflicts:
	ChangeLog
	checks/netapp_api_volumes

---

 .werks/2072                 |   16 ++++++++++++++
 ChangeLog                   |    1 +
 agents/special/agent_netapp |   10 +++++----
 checks/netapp_api_disk      |   50 ++++++++++++++++++++++++++-----------------
 checks/netapp_api_volumes   |   10 +++++++--
 5 files changed, 61 insertions(+), 26 deletions(-)

diff --git a/.werks/2072 b/.werks/2072
new file mode 100644
index 0000000..85eabf4
--- /dev/null
+++ b/.werks/2072
@@ -0,0 +1,16 @@
+Title: agent_netapp, netapp_api_volumes, netapp_api_disks: Improved check output
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1430232561
+
+netapp_api_volumes:<br>
+fixed misleading warning for offline volumes, now also reports inode information
+
+
+netapp_api_disks:<br>
+reformatted check output, fixed incorrect disk numbers, data and parity disk now have a separate prefailed information.
+
diff --git a/ChangeLog b/ChangeLog
index 8a0ed7f..4a2b5ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -348,6 +348,7 @@
     * 2234 FIX: AIX Agent: Forced load of environment and fixed call of trd (Libelle Business Shadow)...
     * 2247 FIX: ibm_svc_mdiskgrp: Made check working with different firmware versions outputs
     * 2071 FIX: windows agent: fileinfo check now correctly reports empty directories...
+    * 2072 FIX: agent_netapp, netapp_api_volumes, netapp_api_disks: Improved check output...
 
     Multisite:
     * 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index 83c8947..32147d1 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -55,7 +55,8 @@ netapp_objects["netapp_api_cpu"] = {
 }
 
 netapp_objects["netapp_api_volumes"] = {
-    "configs"          : { "volume-list-info" : ["name", "volume-info", "size-total", "size-available", "volumes"] },
+    "configs"          : { "volume-list-info" : ["name", "volume-info", "size-total", "size-available",
+                                                 "volumes", "files-total", "files-used", "state"] },
     # Feel free to execute this construct in a python interpreter. It just creates a list of elements...
     "counters"         : { "volume": sum(map(lambda x: ["%s" % x, "nfs_%s" % x, "cifs_%s" % x, "san_%s" % x, "fcp_%s" % x, "iscsi_%s" % x],
                                         sum(map(lambda x: ["read_%s" % x, "write_%s" % x], ["data", "latency"]), [])), []) + [ "instance_name" ] }
@@ -72,6 +73,7 @@ netapp_objects["netapp_api_protocol"] = {
                            "iscsi": ["instance_name", "iscsi_read_ops", "iscsi_write_ops"],
                            "cifs":  ["instance_name", "cifs_read_ops", "cifs_write_ops"],
                            "fcp":   ["instance_name", "fcp_read_ops", "fcp_write_data"],
+#                           "system": [],
                           }
 }
 
@@ -89,6 +91,7 @@ netapp_objects["netapp_api_cluster"] = {
 }
 
 
+
 def output_disks(results):
     bay_list   = results["configs"]["storage-shelf-bay-list-info"].child_get("shelf-bay-list")
     shelf_uids = {}
@@ -117,7 +120,8 @@ def output_disks(results):
         print "disk-detail-info"
         print "%s\t%s" % ("disk-uid", disk_uid)
         print "%s\t%s" % ("raid-state", raid_state)
-        for key in [ "bay", "used-space", "physical-space", "shelf", "serial-number" ]:
+        for key in [ "bay", "used-space", "physical-space", "shelf", "serial-number",
+                     "is-prefailed", "raid-type" ]:
             print "%s\t%s" % (key, disk.child_get_string(key))
 
     print "[config_instance]\tshelf-uids-of-disks"
@@ -414,8 +418,6 @@ try:
         raise Exception("\n".join(errors))
 
 except Exception, e:
-    if opt_debug:
-        raise
     sys.stderr.write("Error(s) on processing the received data:\n%s" % e)
     sys.exit(1)
 
diff --git a/checks/netapp_api_disk b/checks/netapp_api_disk
index 66ac334..4582ff6 100644
--- a/checks/netapp_api_disk
+++ b/checks/netapp_api_disk
@@ -60,33 +60,44 @@ def check_netapp_api_disk_summary(_no_item, params, info):
     my_disks = dict([disk for disk in disks.items() if not disk[1].get("raid-state") == "partner"])
 
     spare_count  = 0
-    prefailed_disks = []
-    broken_disks    = []
+    data_disks   = []
+    parity_disks = []
+    broken_disks = []
+    prefailed_data_disks   = []
+    prefailed_parity_disks = []
     raid_states     = {}
 
-    phys_space = 0
-    total_space  = 0
+    phys_space  = 0
+    total_space = 0
 
     for name, disk in my_disks.items():
-        if disk.get("raid-state") == "partner":
-            continue # Disk belongs to partner
-
         total_space  += int(disk.get("used-space"))
+        raid_type = disk.get("raid-type")
 
         if disk.get("raid-state", "") == "broken":
             broken_disks.append(disk)
-        elif disk.get("is-prefailed", "false") != "false":
-            prefailed_disks.append(disk)
+        elif disk.get("is-prefailed", "false") not in [ "false", "None" ]:
+            if raid_type in ["parity", "dparity"]:
+                prefailed_parity_disks.append(disk)
+            elif raid_type == "data":
+                prefailed_data_disks.append(disk)
         elif disk.get("raid-state","") == "spare":
             spare_count += 1
-        if disk.get("raid-type"):
-            raid_states.setdefault(disk["raid-type"], 0)
-            raid_states[disk["raid-type"]] += 1
+
+        if raid_type in ["parity", "dparity"]:
+            parity_disks.append(disk)
+        elif raid_type in ["data"]:
+            data_disks.append(disk)
 
     yield 0, "Total Raw Capacity: %s" % get_bytes_human_readable(total_space), [("total_space", total_space)]
-    yield 0, "Disks Total: %s Spare: %s" % (len(my_disks), spare_count), [ ("total", len(my_disks)),
-                                                                           ("spare", spare_count),
-                                                                           ("broken", len(broken_disks)) ]
+    yield 0, "Total disks: %d (%d Spare)"      % (len(my_disks) - len(broken_disks), spare_count), [
+                                                        ("total", len(my_disks)),
+                                                        ("spare", spare_count),
+                                                        ("broken", len(broken_disks)) ]
+
+    yield 0, "Data disks: %d (%d prefailed)"   % (len(data_disks),   len(prefailed_data_disks))
+    yield 0, "Parity disks: %d (%d prefailed)" % (len(parity_disks), len(prefailed_parity_disks))
+    yield 0, "Broken disks: %d" % len(broken_disks)
 
 
     disk_to_shelf_map = {}
@@ -98,8 +109,9 @@ def check_netapp_api_disk_summary(_no_item, params, info):
                     disk_to_shelf_map[disk] = shelf
         return disk_to_shelf_map.get(disk_uid)
 
-    for text, disks, state in [("Prefailed", prefailed_disks, 0),
-                               ("Broken"   , broken_disks,    0)]:
+    for text, disks, state in [("Data-Prefailed",   prefailed_data_disks, 0),
+                               ("Parity-Prefailed", prefailed_parity_disks, 0),
+                               ("Broken",           broken_disks,    0)]:
         info = []
         for disk in disks:
             disk_info = "Serial: %s" % disk.get("serial-number")
@@ -111,9 +123,7 @@ def check_netapp_api_disk_summary(_no_item, params, info):
             info.append(disk_info)
 
         if info:
-            yield state, "%s: %s - %s" % (text, len(disks), " / ".join(info))
-        else:
-            yield 0, "%s: %s" % (text, len(disks))
+            yield state, "%s Disk Details: %s" % (text, " / ".join(info))
 
     if broken_disks:
         warn, crit  = params.get("broken_spare_ratio", (1.0, 50.0))
diff --git a/checks/netapp_api_volumes b/checks/netapp_api_volumes
index d6bb34d..62616ee 100644
--- a/checks/netapp_api_volumes
+++ b/checks/netapp_api_volumes
@@ -62,12 +62,18 @@ def check_netapp_api_volumes(item, params, parsed):
 
     volume = find_volume(item)
     if not volume:
-        return (3, "Volume not found in agent output")
+        return 3, "Volume not found in agent output"
+
+    if volume.get("state") == "offline":
+        return 1, "Volume is offline"
 
     mega = 1024.0 * 1024.0
     size_total = int(volume.get("size-total")) / mega
     size_avail = int(volume.get("size-available")) / mega
-    state, info, perf = df_check_filesystem_list(item, params, [(volume.get("name"), size_total, size_avail, 0)])
+    inodes_total = int(volume.get("files-total"))
+    inodes_avail = inodes_total - int(volume.get("files-used"))
+    state, info, perf = df_check_filesystem_single(g_hostname, item, size_total, size_avail, 0,
+                                                   inodes_total, inodes_avail, params)
 
     counter_wrapped = False
     counters        = []



More information about the checkmk-commits mailing list