Module: check_mk
Branch: master
Commit: 3ce61a4a7db11b854883fd247344203ec69b8f51
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ce61a4a7db11b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 6 14:29:51 2013 +0100
Add: winperf_phydisk can now output IOPS
---
ChangeLog | 1 +
checkman/winperf_phydisk | 4 ++++
checks/diskstat.include | 19 +++++++++++++------
checks/winperf_phydisk | 16 ++++++++++------
4 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b0f9ecc..2aa33a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
* if: Inventory settings can now be set host based
* FIX: lnx_bonding/ovs_bonding: correct definition of bonding.include
* Add: if check now able to handle interface groups (if_groups)
+ * Add: winperf_phydisk can now output IOPS
Multisite:
* Added comment painter to notification related views
diff --git a/checkman/winperf_phydisk b/checkman/winperf_phydisk
index f14bb0e..d89a342 100644
--- a/checkman/winperf_phydisk
+++ b/checkman/winperf_phydisk
@@ -28,6 +28,8 @@ description:
it possible to ignore short "peaks" and only trigger and longer
phases of high disk activity.
+ The check also gives info on the IOPS.
+
item:
Either {"SUMMARY"} for a summarized check of alls disks or the
name of the disk device, e.g. {"C:"}.
@@ -62,6 +64,8 @@ perfdata:
In the legacy mode only one variable: the throughput since the last check
in in bytes(!) per second, either for read or for write.
+ The IOPS are returned if {"latency_perfdata"} is set to True.
+
inventory:
The inventory is configured via {diskstat_inventory_mode}. If this is set
to {"single"} (the default), then one check will be created for each
diff --git a/checks/diskstat.include b/checks/diskstat.include
index 553ab76..4c84054 100644
--- a/checks/diskstat.include
+++ b/checks/diskstat.include
@@ -130,17 +130,25 @@ def check_diskstat_line(this_time, item, params, line):
if average_range != None:
perfdata = [ perfdata[0], perfdata[2], perfdata[1], perfdata[3] ]
- # Do Latency computation if this information is available:
- if len(line) >= 6 and line[3] >= 0:
- reads, writes, timems = map(int, line[3:6])
- ios = reads + writes
+ # Process IOs when available
+ if line[3] >= 0 and line[4] > 0:
+ reads, writes = map(int, line[3:5])
+ ios = reads + writes
timedif, ios_per_sec = get_counter(countername + ".ios", this_time,
ios)
+ infos.append("IOs: %.2f/sec" % ios_per_sec)
+
+ if params.get("latency_perfdata"):
+ perfdata.append(("ios", ios_per_sec))
+
+ # Do Latency computation if this information is available:
+ if len(line) >= 6 and line[5] >= 0:
+ timems = int(line[5])
timedif, timems_per_sec = get_counter(countername + ".time", this_time,
timems)
if not ios_per_sec:
latency = 0.0
else:
latency = timems_per_sec / ios_per_sec
- infos.append("IOs: %.2f/sec, Latency: %.2fms" % (ios_per_sec,
latency))
+ infos.append("Latency: %.2fms" % latency)
if "latency" in params:
warn, crit = params["latency"]
if latency >= crit:
@@ -153,7 +161,6 @@ def check_diskstat_line(this_time, item, params, line):
warn, crit = None, None
if params.get("latency_perfdata"):
- perfdata.append(("ios", ios_per_sec))
perfdata.append(("latency", latency, warn, crit))
# Queue Lengths (currently only Windows). Windows uses counters here.
diff --git a/checks/winperf_phydisk b/checks/winperf_phydisk
index 052325a..f113775 100644
--- a/checks/winperf_phydisk
+++ b/checks/winperf_phydisk
@@ -45,8 +45,8 @@
# -24 1638326933 1638326933 average_timer
# -24 18448 18448 average_base
# -22 36283 36283 counter
-# -20 17835 17835 counter
-# -18 18448 18448 counter
+# -20 17835 17835 counter ----> Disk Reads/sec
+# -18 18448 18448 counter ----> Disk Writes/sec
# -16 1315437056 1315437056 bulk_count
# -14 672711680 672711680 bulk_count ----> Disk Read Bytes/sec
# -12 642725376 642725376 bulk_count ----> Disk Write Bytes/sec
@@ -66,11 +66,15 @@ def winperf_phydisk_convert(info):
disks = [ d.split('_')[-1] for d in info[1][2:-1] ]
for line in info[2:]:
if line[0] == '-14':
- disk_reads = [ int(x) / 512 for x in line[1:-2] ]
+ disk_read_bytes = [ int(x) / 512 for x in line[1:-2] ]
elif line[0] == '-12':
- disk_writes = [ int(x) / 512 for x in line[1:-2] ]
+ disk_write_bytes = [ int(x) / 512 for x in line[1:-2] ]
+ elif line[0] == '-20':
+ disk_reads = [ int(x) for x in line[1:-2] ]
+ elif line[0] == '-18':
+ disk_writes = [ int(x) for x in line[1:-2] ]
elif line[0] == '1168': # Average Disk Read Queue Length
- disk_readq_ctrs = [ int(x) for x in line[1:-2] ]
+ disk_readq_ctrs = [ int(x) for x in line[1:-2] ]
elif line[0] == '1170': # Average Disk Read Queue Length
disk_writeq_ctrs = [ int(x) for x in line[1:-2] ]
@@ -78,7 +82,7 @@ def winperf_phydisk_convert(info):
# information)
empty = [ -1 for x in disks ]
- return zip(disks, disk_reads, disk_writes, empty, empty, empty, disk_readq_ctrs,
disk_writeq_ctrs)
+ return zip(disks, disk_read_bytes, disk_write_bytes, reads, writes, empty,
disk_readq_ctrs, disk_writeq_ctrs)
def inventory_winperf_phydisk(info):
return inventory_diskstat_generic(winperf_phydisk_convert(info))