Module: check_mk
Branch: master
Commit: d1701043f44134d0edda9dab0c102e8a5ec256e6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d1701043f44134…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Mar 30 21:02:00 2011 +0200
if/if64: add Perf-O-Meter in case of unknown bandwidth
---
.bugs/36 | 10 +++++++---
web/plugins/perfometer/check_mk.py | 19 +++++++++++++++----
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/.bugs/36 b/.bugs/36
index b5bc62c..c37bba2 100644
--- a/.bugs/36
+++ b/.bugs/36
@@ -1,13 +1,17 @@
Title: Linux-NICs: Check kompatibel zu if/if64 machen
Component: core
+State: done
+Class: cleanup
+Date: 2010-12-21 20:52:24
Benefit: 2
-State: open
Cost: 2
-Date: 2010-12-21 20:52:24
-Class: cleanup
+Fun: 0
Man könnte das doch evtl. kompatibel mit if machen. Und dann evtl auch die
Ausgabe noch kompatibel. Man monitort dann nur die verwendeten NICs. Und
man bau eine neue Sektion <<<nics>>>, welche die Ausgaben von ethtool
und /proc/net/dev kombiniert, damit man einen Check bauen kann, der
wirklich 100% kompatibel zu if ist (dann klappen auch die Network Wethermaps)
+
+2011-03-30 20:39:22: changed state open -> done
+New check named lnx_if
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index da05504..c8bb4e2 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -189,8 +189,8 @@ perfometers["check_mk-ipmi_sensors"] =
perfometer_check_mk_ipmi_sensors
perfometers["check_mk-nvidia.temp"] = perfometer_check_mk_ipmi_sensors
def performeter_check_mk_if(row, check_command, perf_data):
- # return str(perf_data), ""
txt = []
+ have_bw = True
h = '<table><tr>'
for name, perf, color in [
("in", perf_data[0], "#0e6"),
@@ -200,7 +200,8 @@ def performeter_check_mk_if(row, check_command, perf_data):
if bw > 0.0:
rrate = bytes / bw
else:
- return 'unknown bandwidth', '<table></table>'
+ have_bw = False
+ break
drate = max(0.02, rrate ** 0.5 ** 0.5)
rperc = 100 * rrate
dperc = 100 * drate
@@ -211,8 +212,18 @@ def performeter_check_mk_if(row, check_command, perf_data):
else:
h += a + b # color right, white left
txt.append("%.1f%%" % rperc)
- h += '</tr></table>'
- return " ".join(txt), h
+ if have_bw:
+ h += '</tr></table>'
+ return " ".join(txt), h
+
+ # make logarithmic perf-o-meter
+ 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)
+
+ return text, perfometer_logarithmic_dual(
+ in_bytes, "#0e6", out_bytes, "#2af", 1000000, 10)
perfometers["check_mk-if"] = performeter_check_mk_if
perfometers["check_mk-if64"] = performeter_check_mk_if