Module: check_mk
Branch: master
Commit: c10a0410392a69aa7b609c6e49c8989e4bf27cd6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c10a0410392a69…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 9 09:15:02 2010 +0100
statgrab_disk: Fixed byte calculation in plugin output, Added inventory function
---
ChangeLog | 2 ++
checks/statgrab_disk | 10 +++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f0a6421..d029396 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -117,6 +117,8 @@
* Windows agent: .vbs scripts in agents plugins/ directory are executed
automatically with "cscript.exe /Nologo" to prevent wrong file handlers
* aironet_clients: Only counting clients which don't have empty values for
strength
+ * statgrab_disk: Fixed byte calculation in plugin output
+ * statgrab_disk: Added inventory function
Multisite:
* The custom open/close states of custom links are now stored for each
diff --git a/checks/statgrab_disk b/checks/statgrab_disk
index d7e9355..0679f19 100644
--- a/checks/statgrab_disk
+++ b/checks/statgrab_disk
@@ -24,6 +24,11 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+def inventory_statgrab_disk(checkname, info):
+ for line in info:
+ if line[0].endswith('read_bytes') or
line[0].endswith('write_bytes'):
+ return [ ('read', None, None), ('write', None, None) ]
+ return []
def check_statgrab_disk(item, params, info):
# item is 'read' or 'write'
@@ -37,9 +42,8 @@ def check_statgrab_disk(item, params, info):
this_time = int(time.time())
timedif, per_sec = get_counter("diskstat." + item, this_time, this_val)
- mb_per_s = per_sec / 1024.0 # Diskstat output is in KB
perfdata = [ (item, "%dc" % this_val ) ]
- return (0, "OK - %.1fMB/s (in last %d secs)" % (mb_per_s, timedif),
perfdata)
+ return (0, "OK - %s/s (in last %d secs)" %
(get_bytes_human_readable(per_sec), timedif), perfdata)
-check_info['statgrab_disk'] = (check_statgrab_disk, "Disk IO %s", 1,
no_inventory_possible)
+check_info['statgrab_disk'] = (check_statgrab_disk, "Disk IO %s", 1,
inventory_statgrab_disk)