Module: check_mk
Branch: master
Commit: fb24fe0f0607641fa3c502624d328341bfbee07f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb24fe0f060764…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Sep 30 11:34:57 2014 +0200
fsc_temp: Reworked to use new include function
---
checks/fsc_temp | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/checks/fsc_temp b/checks/fsc_temp
index ce4e788..274acc5 100644
--- a/checks/fsc_temp
+++ b/checks/fsc_temp
@@ -32,29 +32,21 @@
# 8: critical level
def inventory_fsc_temp(info):
- # Ignore non-connected sensors
- return [ (line[0], None) for line in info if int(line[1]) < 500 ]
+ for line in info:
+ # Ignore non-connected sensors
+ if int(line[1]) < 500:
+ yield (line[0], None)
-def check_fsc_temp(item, _no_params, info):
- for name, current, warn, crit in info:
- if name != item: continue
- current = int(current)
- warn = int(warn)
- crit = int(crit)
-
- infotext = "%d C (levels at %d C / %d C)" % (current, warn, crit)
- perfdata = [ ("temp", current, warn, crit, 0 ) ]
- if current == -1 or current == 4294967295:
- return(3, "Problem with sensor")
- elif current >= crit and crit > 0:
- return (2, "%s" % infotext, perfdata)
- elif current >= warn and warn > 0:
- return (1, "%s" % infotext, perfdata)
- else:
- return (0, "%s" % infotext, perfdata)
+def check_fsc_temp(item, _no_params, info):
+ for name, rawtemp, warn, crit in info:
+ if name == item:
+ temp = int(rawtemp)
+ if temp == -1 or temp == 4294967295:
+ return 3, "Sensor or component missing"
+ else:
+ return check_temperature(temp, (int(warn), int(crit)))
- return (3, "Sensor %s not found in SNMP data" % item)
check_info['fsc_temp'] = {
"inventory_function" : inventory_fsc_temp,
@@ -64,4 +56,5 @@ check_info['fsc_temp'] = {
"snmp_info" : ( ".1.3.6.1.4.1.231.2.10.2.2.5.2.1.1",
[ 13, 11, 6, 8 ] ),
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.4.1.231.2.10.2.1.1.0"),
"group" : "temperature_auto",
+ "includes" : [ "temperature.include" ],
}