Module: check_mk
Branch: master
Commit: 815e203a824bfd24faaf6a4b8f278878f4d08eb2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=815e203a824bfd…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Aug 5 11:17:07 2015 +0200
#2417 winperf_phydisk: can now work in a cluster environment
---
.werks/2417 | 9 +++++++
ChangeLog | 1 +
checks/winperf_phydisk | 61 +++++++++++++++++++++++++++++++++---------------
3 files changed, 52 insertions(+), 19 deletions(-)
diff --git a/.werks/2417 b/.werks/2417
new file mode 100644
index 0000000..cd80893
--- /dev/null
+++ b/.werks/2417
@@ -0,0 +1,9 @@
+Title: winperf_phydisk: can now work in a cluster environment
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1438765575
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 76f5fbb..5d65306 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@
* 2413 esx_vsphere_counters: new check to monitor the disk throughput and latency for
ESX datastores
* 2513 new checks sentry_pdu_outlets sentry_pdu_systempower: monitor the system power
consumption and outlet states of sentry pdu devices which support the Sentry3-MIB
* 2515 juniper_trpz_aps: check is now cluster-aware...
+ * 2417 winperf_phydisk: can now work in a cluster environment
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checks/winperf_phydisk b/checks/winperf_phydisk
index 7c267bd..96df0fd 100644
--- a/checks/winperf_phydisk
+++ b/checks/winperf_phydisk
@@ -69,27 +69,50 @@ def winperf_phydisk_convert(info):
# an almost empty section, where the second line is missing completely
if len(info) == 1:
return []
- disks = [ d.split('_')[-1] for d in info[1][3:-1] ]
- for line in info[2:]:
- if line[1] == '-14':
- disk_read_bytes = [ int(x) / 512 for x in line[2:-2] ]
- elif line[1] == '-12':
- disk_write_bytes = [ int(x) / 512 for x in line[2:-2] ]
- elif line[1] == '-20':
- disk_reads = [ int(x) for x in line[2:-2] ]
- elif line[1] == '-18':
- disk_writes = [ int(x) for x in line[2:-2] ]
- elif line[1] == '1168': # Average Disk Read Queue Length
- disk_readq_ctrs = [ int(x) for x in line[2:-2] ]
- elif line[1] == '1170': # Average Disk Read Queue Length
- disk_writeq_ctrs = [ int(x) for x in line[2:-2] ]
- # Missing columns are donted by negative values (Linux sends here latency
- # information)
- empty = [ -1 for x in disks ]
- none = [ None for x in disks ] # Used as dummy node info
+ lines = iter(info)
+ entries = []
+ current_disks = []
+ current_read_bytes = []
+ current_write_bytes = []
+ current_disk_reads = []
+ current_disk_writes = []
+ current_diskreadq_ctrs = []
+ current_diskwriteq_ctrs = []
- return zip(none, disks, disk_read_bytes, disk_write_bytes, disk_reads, disk_writes,
empty, disk_readq_ctrs, disk_writeq_ctrs)
+ def finalize_block(nodename):
+ # Missing columns are donted by negative values (Linux sends here latency
information)
+ return zip([nodename for x in current_disks], current_disks,
current_disk_read_bytes,
+ current_disk_write_bytes, current_disk_reads, current_disk_writes, [-1
for x in current_disks],
+ current_disk_readq_ctrs, current_disk_writeq_ctrs)
+
+ current_node = ""
+ try:
+ while True:
+ line = lines.next()
+ if line[2] == "instances:":
+ if current_node != "":
+ entries.extend(finalize_block(current_node))
+ current_node = line[0]
+ current_disks = [ d.split('_')[-1] for d in line[3:-1] ]
+ elif line[1] == '-14':
+ current_disk_read_bytes = [ int(x) / 512 for x in line[2:-2] ]
+ elif line[1] == '-12':
+ current_disk_write_bytes = [ int(x) / 512 for x in line[2:-2] ]
+ elif line[1] == '-20':
+ current_disk_reads = [ int(x) for x in line[2:-2] ]
+ elif line[1] == '-18':
+ current_disk_writes = [ int(x) for x in line[2:-2] ]
+ elif line[1] == '1168': # Average Disk Read Queue Length
+ current_disk_readq_ctrs = [ int(x) for x in line[2:-2] ]
+ elif line[1] == '1170': # Average Disk Read Queue Length
+ current_disk_writeq_ctrs = [ int(x) for x in line[2:-2] ]
+ except StopIteration:
+ if current_node != "":
+ entries.extend(finalize_block(current_node))
+ pass
+
+ return entries
def inventory_winperf_phydisk(info):
return inventory_diskstat_generic(winperf_phydisk_convert(info))