Module: check_mk
Branch: master
Commit: be3ef3363762f61e1e29d2cc18536b5cee9e618d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=be3ef3363762f6…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Feb 23 16:20:48 2017 +0100
8755 FIX fixed statgrab_disk: Now computes rate correctly
Change-Id: If36dc7caedac80beb87441b969a56fbe5bbcd6db
---
.werks/8755 | 11 +++++++++++
checks/statgrab_disk | 15 ++++-----------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/.werks/8755 b/.werks/8755
new file mode 100644
index 0000000..6bc323a
--- /dev/null
+++ b/.werks/8755
@@ -0,0 +1,11 @@
+Title: fixed statgrab_disk: Now computes rate correctly
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1487863217
+
+
diff --git a/checks/statgrab_disk b/checks/statgrab_disk
index 881401c..cf47de4 100644
--- a/checks/statgrab_disk
+++ b/checks/statgrab_disk
@@ -40,15 +40,16 @@
def parse_statgrab_disk(info):
parsed = {}
+ now = time.time()
for line in info:
disk_name = line[0].split(".")[0]
parsed.setdefault(disk_name, {})
if line[0].endswith('read_bytes'):
- parsed[disk_name]["read_bytes"] = int(line[1])
+ parsed[disk_name]["read_throughput"] =
get_rate("statgrab_disk.read.%s" % disk_name, now, int(line[1]))
elif line[0].endswith('write_bytes'):
- parsed[disk_name]["write_bytes"] = int(line[1])
+ parsed[disk_name]["write_throughput"] =
get_rate("statgrab_disk.write.%s" % disk_name, now, int(line[1]))
elif line[0].endswith("systime"):
parsed[disk_name]["systime"] = int(line[1])
@@ -61,15 +62,7 @@ def inventory_statgrab_disk(parsed):
def check_statgrab_disk(item, params, parsed):
- now = time.time()
- disks = {}
- for disk_name, attrs in parsed.items():
- disks[disk_name] = {
- "read_throughput" : get_rate("statgrab_disk.read.%s" %
item, now, attrs["read_bytes"]),
- "write_throughput" : get_rate("statgrab_disk.write.%s" %
item, now, attrs["write_bytes"]),
- }
-
- return check_diskstat_dict(item, params, disks)
+ return check_diskstat_dict(item, params, parsed)
check_info["statgrab_disk"] = {