Module: check_mk
Branch: master
Commit: f4fedf1ce91192ecdfa0473589e8740c35a91692
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f4fedf1ce91192…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 31 09:25:43 2011 +0200
if/if64: also show perf-o-meter if speed is unknown
---
ChangeLog | 7 ++++---
web/plugins/perfometer/check_mk.py | 5 +++--
web/plugins/views/perfometer.py | 12 ++++++++++++
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 58d78af..6b2c7fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,12 +36,13 @@
* FIX: mk_logwatch: improve implementation in order to save RAM
* FIX: mk_oracle: Updated tablespace query to use 'used blocks' instead of
'user blocks'
* FIX: bluecoat_sensors: Using scale parameter provided by the host for reported
values
+ * FIX: fjdarye60_devencs, fjdarye60_disks.summary: added snmp scan functions
+ * FIX: decru_*: added snmp scan functions
* printer_supply: Changed order of tests. When a printer reports -3 this
is used before the check if maxlevel is -2.
* printer_supply: Skipping inventory of supplies which have current value
and maxlevel both set to -2.
* cisco_locif: The check has been removed. Please switch to if/if64
- * if/if64: scan function now also detects devices where the first port
has not the index 1
* cisco_temp/cisco_temp_perf: scan function handles sensors not beginning
with index 1
@@ -50,8 +51,6 @@
* printer_alerts: Added new check for monitoring alert states reported by
printers using the PRINTER-MIB
* diskstat: rewritten check: now show different devices, r+w in one check
- * FIX: fjdarye60_devencs, fjdarye60_disks.summary: added snmp scan functions
- * FIX: decru_*: added snmp scan functions
* canon_pages: Added new check for monitoring processed pages on canon
printer/multi-function devices
* strem1_sensors: added check to monitor sensors attached to Sensatorinc EM1 devices
@@ -61,6 +60,8 @@
* lnx_if: new check for Linux NICs compatible with if/if64 replacing
netif.* and netctr.
* if/if64: also output performance data if operstate not as expected
+ * if/if64: scan function now also detects devices where the first port
+ * if/if64: also show perf-o-meter if speed is unknown
1.1.10:
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index c8bb4e2..454170e 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -220,10 +220,11 @@ def performeter_check_mk_if(row, check_command, perf_data):
in_bytes = savefloat(perf_data[0][1])
out_bytes = savefloat(perf_data[5][1])
MB = 1000000.0
- text = "%.1fM/s %.1fM/s" % (in_bytes/MB, out_bytes/MB)
+ text = "%s/s %s/s" % (
+ number_human_readable(in_bytes), number_human_readable(out_bytes))
return text, perfometer_logarithmic_dual(
- in_bytes, "#0e6", out_bytes, "#2af", 1000000, 10)
+ in_bytes, "#0e6", out_bytes, "#2af", 1000000, 5)
perfometers["check_mk-if"] = performeter_check_mk_if
perfometers["check_mk-if64"] = performeter_check_mk_if
diff --git a/web/plugins/views/perfometer.py b/web/plugins/views/perfometer.py
index 2fdac40..f05040f 100644
--- a/web/plugins/views/perfometer.py
+++ b/web/plugins/views/perfometer.py
@@ -89,6 +89,18 @@ def perfometer_logarithmic_dual(value_left, color_left, value_right,
color_right
return result + '</tr></table>'
+def number_human_readable(n):
+ n = float(n)
+ if abs(n) > 1024 * 1024 * 1024:
+ return "%.1fG" % (n / (1024.0 * 1024 * 1024))
+ elif abs(n) > 1024 * 1024:
+ return "%.1fM" % (n / (1024.0 * 1024))
+ elif abs(n) > 1024:
+ return "%.fK" % (n / 1024.0)
+ else:
+ return "%.1fB" % n
+
+
perfometer_plugins_dir = defaults.web_dir + "/plugins/perfometer"
for fn in os.listdir(perfometer_plugins_dir):
if fn.endswith(".py"):