diff --git a/src/snell_iqh/baseinfo.ini b/src/snell_iqh/baseinfo.ini new file mode 100644 index 0000000..454c16b --- /dev/null +++ b/src/snell_iqh/baseinfo.ini @@ -0,0 +1,7 @@ +[info] +title = Snell IQH SNMP Checks +author = Markus Birth +description = SNMP based checks for the Snell IQH series frame controller. +version = 2016.06.01.1 +version.min_required = 1.2.8p2 +download_url = https://github.com/mbirth/check_mk-plugins diff --git a/src/snell_iqh/checks/snell_iqh_cpu b/src/snell_iqh/checks/snell_iqh_cpu new file mode 100644 index 0000000..f2549c3 --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_cpu @@ -0,0 +1,46 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_cpu(info): + inventory = [] + for oidEnd, cpup in info: + if cpup != "-": + inventory.append( ("CPU Usage", None) ) + return inventory + +def check_snell_iqh_cpu(item, _no_params, info): + for oidEnd, cpup in info: + if cpup != "-": + cpup = int(cpup) + message = "%s%%" % (cpup) + if cpup > 98: + status = 2 + elif cpup > 95: + status = 1 + else: + status = 0 + + perfdata = [ ("CPU_Usage", cpup, 95, 98, 0, 100) ] + return status, message, perfdata + + return 3, "%s not found in SNMP data." % item + +check_info["snell_iqh_cpu"] = { + "check_function" : check_snell_iqh_cpu, + "inventory_function" : inventory_snell_iqh_cpu, + "service_description" : "%s", + "snmp_info" : (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, # "429.1.1.256" (IQH3) or "475.1.1.256" (IQH1) + 17240, # CPU Usage (%) + ]), + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : True +} diff --git a/src/snell_iqh/checks/snell_iqh_eth b/src/snell_iqh/checks/snell_iqh_eth new file mode 100644 index 0000000..e5ffae5 --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_eth @@ -0,0 +1,58 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_eth(info): + inventory = [] + for oidend, lname, lstate, lspeed, llastchange, lerrors, ltrafficin, ltrafficout in info[0]: + if lstate == "Active": + inventory.append( ( lname, None) ) + return inventory + +def check_snell_iqh_eth(item, _no_params, info): + for oidend, lname, lstate, lspeed, llastchange, lerrors, ltrafficin, ltrafficout in info[0]: + if lname == item: + message = "%s with %s, Errors: %s (IN: %s / OUT: %s)" % (lstate, lspeed, lerrors, ltrafficin, ltrafficout) + if lstate == "Active": + status = 0 + else: + status = 2 + + errorcount = int("0"+lerrors.split(" ")[0]) + tin = savefloat(ltrafficin.split(" ")[0]) + tout = savefloat(ltrafficout.split(" ")[0]) + + perfdata = [ + ("Traffic_In", tin, None, None, 0, 100), + ("Traffic_Out", tout, None, None, 0, 100), + ("Errors", errorcount, None, None, 0, 100), + ] + + return status, message, perfdata + + return 3, "%s not found in SNMP data." % item + +check_info["snell_iqh_eth"] = { + "check_function" : check_snell_iqh_eth, + "inventory_function" : inventory_snell_iqh_eth, + "service_description" : "%s", + "snmp_info" : [(".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2030, # lan1name ("FastEthernet0/1") + 2031, # lan1state ("Active") + 2032, # lan1speed ("100 Mbit/s Full Dup") + 2033, # lan1lastChange ("000:00:00:00") + 2034, # lan1errors ("0 in total") + 2035, # lan1trafficIn ("0.0 KBytes/sec") + 2036, # lan1trafficOut ("0.0 KBytes/sec") + ])], + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : True +} diff --git a/src/snell_iqh/checks/snell_iqh_fans b/src/snell_iqh/checks/snell_iqh_fans new file mode 100644 index 0000000..22502f9 --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_fans @@ -0,0 +1,58 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_fans(info): + inventory = [] + for i in range(0, len(info)): + for oidend, fname, fstate in info[i]: + if fstate != "Not Used" and fname != "0": + inventory.append( (fname, None) ) + return inventory + +def check_snell_iqh_fans(item, _no_params, info): + for i in range(0, len(info)): + for oidend, fname, fstate in info[i]: + if item == fname: + message = "%s" % (fstate) + if fstate == "" or fstate[:2] == "OK": + status = 0 + else: + status = 2 + +# perfdata = [ (("Fan %s" % (i+1)), float(vvolt), None, None, vmin, vmax) ] + + return status, message + return 3, "%s not found in SNMP data." % item + +check_info["snell_iqh_fans"] = { + "check_function" : check_snell_iqh_fans, + "inventory_function" : inventory_snell_iqh_fans, + "service_description" : "%s", + "snmp_info" : [(".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2019, # fan1name + 2000, # fan1state ("OK:Low", "OK:Medium", "OK:High") + ]), (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2044, # fan2name + 2043, # fan2state + ]), (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2046, # fan3name + 2045, # fan3state + ]), (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2048, # fan4name + 2047, # fan4state + ])], + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : False +} diff --git a/src/snell_iqh/checks/snell_iqh_faults b/src/snell_iqh/checks/snell_iqh_faults new file mode 100644 index 0000000..8c839c9 --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_faults @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_faults(info): + inventory = [("Faults", None)] + return inventory + +def check_snell_iqh_faults(item, _no_params, info): + faults = False + if len(info)>0 and len(info[0])>0: + faults = info[0][1] + + if faults: + message = "%s" % (faults) + if faults[:2] == "OK": + status = 0 + else: + status = 2 +# perfdata = [ ("Sessions", int(sesscount), None, None, 0, 100) ] + + return status, message + return 3, "Faults info not found in SNMP data." + +check_info["snell_iqh_faults"] = { + "check_function" : check_snell_iqh_faults, + "inventory_function" : inventory_snell_iqh_faults, + "service_description" : "%s", + "snmp_info" : (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2028, # Faults ("OK:None") + ]), + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : False +} diff --git a/src/snell_iqh/checks/snell_iqh_power b/src/snell_iqh/checks/snell_iqh_power new file mode 100644 index 0000000..5b6ddfd --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_power @@ -0,0 +1,59 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_power(info): + inventory = [] + for oidend, pusage, pmax, pcheck in info: + inventory.append( ("Power Usage", None) ) + return inventory + +def check_snell_iqh_power(item, _no_params, info): + for oidend, pusage, pmax, pcheck in info: + message = "%s (Max %s) (Check: %s)" % (pusage, pmax, pcheck) + if pusage[:2] == "OK" and pcheck == "OK": + status = 0 + elif ( pusage[:2] == "OK" and pcheck == "" ) or ( pusage == "" and pcheck == "OK"): + # Don't signal unknown, at least one item is "OK" + status = 0 + else: + status = 2 + + perfdata = [] + if pusage != "": + pval = pusage.split(":", 2)[1] + + if pval[-2:] == "LU": + # IQH3B reports power as LU (Load Units) instead of W (Watts) + pvaln = saveint(pval[:-2]) + pmaxn = saveint(pmax[:-2]) + else: + pvaln = saveint(pval[:-1]) + pmaxn = saveint(pmax[:-1]) + + perfdata = [ ("Power_Usage", pvaln, None, pmaxn, 0, pmaxn) ] + + return status, message, perfdata + + return 3, "%s not found in SNMP data." % item + +check_info["snell_iqh_power"] = { + "check_function" : check_snell_iqh_power, + "inventory_function" : inventory_snell_iqh_power, + "service_description" : "%s", + "snmp_info" : (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2056, # Power Usage ("OK:82W") + 2057, # Power Max ("141W") + 2058, # Power Check ("OK") + ]), + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : True +} diff --git a/src/snell_iqh/checks/snell_iqh_psu b/src/snell_iqh/checks/snell_iqh_psu new file mode 100644 index 0000000..11696e4 --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_psu @@ -0,0 +1,53 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_psu(info): + inventory = [] + for i in range(0, len(info)): + for oidend, pname, pstate in info[i]: + if pstate != "Not Used" and pname != "0": + inventory.append( (pname, None) ) + return inventory + +def check_snell_iqh_psu(item, _no_params, info): + for i in range(0, len(info)): + for oidend, pname, pstate in info[i]: + if item == pname: + message = "%s" % (pstate) + if pstate == "OK": + status = 0 + elif pstate == "": + status = 3 + else: + status = 2 + +# perfdata = [ (("PSU %s" % (i+1)), float(vvolt), None, None, vmin, vmax) ] + + return status, message + + return 3, "%s not found in SNMP data." % item + +check_info["snell_iqh_psu"] = { + "check_function" : check_snell_iqh_psu, + "inventory_function" : inventory_snell_iqh_psu, + "service_description" : "%s", + "snmp_info" : [(".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2020, # psu1name + 2001, # psu1state + ]), (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2021, # psu2name + 2002, # psu2state + ])], + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : False +} diff --git a/src/snell_iqh/checks/snell_iqh_sessions b/src/snell_iqh/checks/snell_iqh_sessions new file mode 100644 index 0000000..956d79c --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_sessions @@ -0,0 +1,39 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_sessions(info): + inventory = [("Sessions", None)] +# for sesscount in info: +# inventory.append( ("Sessions", None) ) + return inventory + +def check_snell_iqh_sessions(item, _no_params, info): + if len(info)>0 and len(info[0])>1: + sesscount = info[0][1] + message = "%s Gateway Ctrl Session%s" % (sesscount, "s" if sesscount!="1" else "") + status = 0 + perfdata = [ ("Sessions", int("0"+sesscount), None, None, 0, 100) ] + + return status, message, perfdata + + return 3, "Sessions info not found in SNMP data." + +check_info["snell_iqh_sessions"] = { + "check_function" : check_snell_iqh_sessions, + "inventory_function" : inventory_snell_iqh_sessions, + "service_description" : "%s", + "snmp_info" : (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2007, # No. of Gateway Ctrl Sessions + ]), + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : True +} diff --git a/src/snell_iqh/checks/snell_iqh_temp b/src/snell_iqh/checks/snell_iqh_temp new file mode 100644 index 0000000..0bc1ff9 --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_temp @@ -0,0 +1,61 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +factory_settings["snell_iqh_temp_default_levels"] = { + "levels": (36, 39), # levels for system temperature +} + +def inventory_snell_iqh_temp(info): + inventory = [] + for i in range(0, len(info)): + for oidend, tname, ttemp, tstate in info[i]: + if tname != "0": + inventory.append( (tname, None) ) + return inventory + +def check_snell_iqh_temp(item, params, info): + for i in range(0, len(info)): + for oidend, tname, ttemp, tstate in info[i]: + if tname == item: + message = u"%s - %s℃" % (tstate, ttemp) + # 36°C = warning / 39°C = critical (should be signaled from the system itself) + if ( tstate == "OK" or tstate == "" ) and saveint("0"+ttemp)<39: + status = 0 + else: + status = 2 + + perfdata = [] + if ttemp != "": + perfdata = [ (tname.replace(" ", "_"), saveint(ttemp), None, None, 0, 50) ] + + return status, message, perfdata + return 3, "%s not found in SNMP data." % (item) + +check_info["snell_iqh_temp"] = { + "check_function" : check_snell_iqh_temp, + "inventory_function" : inventory_snell_iqh_temp, + "service_description" : "%s", + "group" : "temperature", + "default_levels_variable" : "snell_iqh_temp_default_levels", + "snmp_info" : [(".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2022, # temp1name + 2008, # temp1Celsius + 2003, # temp1State + ]), (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1" ], [ + OID_END, + 2023, # temp2name + 2009, # temp2Celsius + 2004, # temp2State + ])], + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : True +} diff --git a/src/snell_iqh/checks/snell_iqh_voltage b/src/snell_iqh/checks/snell_iqh_voltage new file mode 100644 index 0000000..385d9cb --- /dev/null +++ b/src/snell_iqh/checks/snell_iqh_voltage @@ -0,0 +1,60 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth +# MIBs: ftp://ftp.snellgroup.com/RollCall/SNMP_MIBs/ + +def inventory_snell_iqh_voltage(info): + inventory = [] + for i in range(0, len(info)): + for oidend, vname, vvolt, vstate in info[i]: + inventory.append( ( ("Voltage %s" % vname), None) ) + return inventory + +def check_snell_iqh_voltage(item, _no_params, info): + for i in range(0, len(info)): + for oidend, vname, vvolt, vstate in info[i]: + if ("Voltage %s" % vname) == item: + message = "%s - %sV" % (vstate, vvolt) + if vstate == "OK" or vstate == "": + status = 0 + else: + status = 2 + + if vvolt != "" and float(vvolt) < 0: + vmin = -8 + vmax = -7 + else: + vmin = 7 + vmax = 8 + + perfdata = [] + if vvolt != "": + perfdata = [ (("Voltage_%s" % (i+1)), float(vvolt), None, None, vmin, vmax) ] + + return status, message, perfdata + return 3, "%s not found in SNMP data." % item + +check_info["snell_iqh_voltage"] = { + "check_function" : check_snell_iqh_voltage, + "inventory_function" : inventory_snell_iqh_voltage, + "service_description" : "%s", + "snmp_info" : [(".1.3.6.1.4.1.7995.1.3.1" , [ "429.1.1", "475.1.1" ], [ + OID_END, + 2024, # volt1name + 2025, # volt1Volt + 2005, # volt1State + ]), (".1.3.6.1.4.1.7995.1.3.1", [ "429.1.1", "475.1.1"], [ + OID_END, + 2026, # volt2name + 2027, # volt2Volt + 2006, # volt2State + ])], + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.7995.1.3"), + "has_perfdata" : True +} diff --git a/src/snell_iqh/web/htdocs/images/icons/snell.png b/src/snell_iqh/web/htdocs/images/icons/snell.png new file mode 100644 index 0000000..cb620b9 Binary files /dev/null and b/src/snell_iqh/web/htdocs/images/icons/snell.png differ diff --git a/src/snell_iqh/web/plugins/perfometer/snell_iqh_cpu.py b/src/snell_iqh/web/plugins/perfometer/snell_iqh_cpu.py new file mode 100644 index 0000000..94bcda0 --- /dev/null +++ b/src/snell_iqh/web/plugins/perfometer/snell_iqh_cpu.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth + +def perfometer_snell_iqh_cpu(row, check_command, perfdata): + if len(perfdata) < 1: + return "", "" + + ccur = int(perfdata[0][1]) + #cwarn = int(perfdata[0][2]) + #ccrit = int(perfdata[0][3]) + + cwarn = 95 + ccrit = 98 + + if ccur > ccrit: + color = "#f88" + elif ccur > cwarn: + color = "#ff6" + else: + color = "#8f8" + + return "%i%%" % ccur, perfometer_linear(ccur, color) + +perfometers["check_mk-snell_iqh_cpu"] = perfometer_snell_iqh_cpu diff --git a/src/snell_iqh/web/plugins/perfometer/snell_iqh_eth.py b/src/snell_iqh/web/plugins/perfometer/snell_iqh_eth.py new file mode 100644 index 0000000..f0f9ada --- /dev/null +++ b/src/snell_iqh/web/plugins/perfometer/snell_iqh_eth.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth + +def perfometer_snell_iqh_eth(row, check_command, perfdata): + if len(perfdata) < 2: + return "", "" + + tin = float(perfdata[0][1]) + tout = float(perfdata[1][1]) + + text = "%-.1fKB/s   %-.1fKB/s" % (tin, tout) + + return text, perfometer_logarithmic_dual( + tin, "#60e0a0", tout, "#60a0e0", 10, 10) + +perfometers["check_mk-snell_iqh_eth"] = perfometer_snell_iqh_eth diff --git a/src/snell_iqh/web/plugins/perfometer/snell_iqh_power.py b/src/snell_iqh/web/plugins/perfometer/snell_iqh_power.py new file mode 100644 index 0000000..6388a0e --- /dev/null +++ b/src/snell_iqh/web/plugins/perfometer/snell_iqh_power.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth + +def perfometer_snell_iqh_power(row, check_command, perfdata): + if len(perfdata) < 1: + return "", "" + + pcur = int(perfdata[0][1]) + pmax = int(perfdata[0][6]) + + percent = float(pcur)*100.0/float(pmax) + + return "%i%%" % percent, perfometer_linear(percent, "#66a") + +perfometers["check_mk-snell_iqh_power"] = perfometer_snell_iqh_power diff --git a/src/snell_iqh/web/plugins/perfometer/snell_iqh_temp.py b/src/snell_iqh/web/plugins/perfometer/snell_iqh_temp.py new file mode 100644 index 0000000..c531de7 --- /dev/null +++ b/src/snell_iqh/web/plugins/perfometer/snell_iqh_temp.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth + +def perfometer_snell_iqh_temp(row, check_command, perfdata): + if len(perfdata) < 1: + return "", "" + + tcur = int(perfdata[0][1]) + tmax = int(perfdata[0][6]) + + return "%i℃" % tcur, perfometer_linear(tcur*100/tmax, "#f82") + +perfometers["check_mk-snell_iqh_temp"] = perfometer_snell_iqh_temp diff --git a/src/snell_iqh/web/plugins/perfometer/snell_iqh_voltage.py b/src/snell_iqh/web/plugins/perfometer/snell_iqh_voltage.py new file mode 100644 index 0000000..ff3a510 --- /dev/null +++ b/src/snell_iqh/web/plugins/perfometer/snell_iqh_voltage.py @@ -0,0 +1,19 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth + +def perfometer_snell_iqh_voltage(row, check_command, perfdata): + if len(perfdata) < 1: + return "", "" + + vcur = abs(float(perfdata[0][1])) + + return "%.1fV" % vcur, perfometer_linear( (vcur-7.0)*100, "#48f") + +perfometers["check_mk-snell_iqh_voltage"] = perfometer_snell_iqh_voltage