Module: check_mk
Branch: master
Commit: 95aa9237c57cceb68710b3558775ee9581fb883c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=95aa9237c57cce…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jan 11 14:46:33 2016 +0100
minor cleanup in cisco_cpu
---
checks/cisco_cpu | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/checks/cisco_cpu b/checks/cisco_cpu
index d548137..2d32c92 100644
--- a/checks/cisco_cpu
+++ b/checks/cisco_cpu
@@ -41,15 +41,19 @@ def check_cisco_cpu(item, params, info):
util = float(info[0][1])
else:
util = float(info[0][0])
- infotext = "%2.1f%% utilization in the last 5 minutes" % util
+
+ state = 0
+ infotext = "%.1f%% utilization in the last 5 minutes" % util
+
warn, crit = params
- perfdata = [("util", util, warn, crit, 0, 100)]
if util >= crit:
- return (2, infotext + " (critical at %d%%)" % crit, perfdata)
+ state = 2
elif util >= warn:
- return (1, infotext + " (warning at %d%%)" % warn, perfdata)
- else:
- return (0, infotext, perfdata)
+ state = 1
+ if state > 0:
+ infotext += " (warn/crit at %.1f%%/%.1f%%)" % (warn, crit)
+
+ return state, infotext, [("util", util, warn, crit, 0, 100)]
check_info["cisco_cpu"] = {
"check_function" : check_cisco_cpu,
@@ -58,7 +62,6 @@ check_info["cisco_cpu"] = {
"has_perfdata" : True,
"group" : "cpu_utilization",
"snmp_scan_function" : lambda oid: "cisco" in
oid(".1.3.6.1.2.1.1.1.0").lower() \
- and oid(".1.3.6.1.4.1.9.9.109.1.1.1.1.*"),
- "snmp_info" : ( ".1.3.6.1.4.1.9.9.109.1.1.1.1", [ 5, 8 ]),
+ and oid(".1.3.6.1.4.1.9.9.109.1.1.1.1.*"),
+ "snmp_info" : ( ".1.3.6.1.4.1.9.9.109.1.1.1.1", [ 5,
8 ]),
}
-