From 058472f58e2c226b9eae1317bbadc59d691fe460 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Tue, 28 Nov 2017 15:02:03 +0100 Subject: [PATCH] Added evertz_fc. --- src/evertz_fc/baseinfo.ini | 7 +++ src/evertz_fc/checks/evertz_fc_framestatus | 45 ++++++++++++++++++ src/evertz_fc/checks/evertz_fc_psu | 53 ++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 src/evertz_fc/baseinfo.ini create mode 100644 src/evertz_fc/checks/evertz_fc_framestatus create mode 100644 src/evertz_fc/checks/evertz_fc_psu diff --git a/src/evertz_fc/baseinfo.ini b/src/evertz_fc/baseinfo.ini new file mode 100644 index 0000000..5a6b430 --- /dev/null +++ b/src/evertz_fc/baseinfo.ini @@ -0,0 +1,7 @@ +[info] +title = Evertz 7800 series frame controller +author = Markus Birth +description = SNMP based checks (framestatus, PSUs) for Evertz 7800 series framecontroller. +version = 2016.02.12.1 +version.min_required = 1.2.8p2 +download_url = https://github.com/mbirth/check_mk-plugins diff --git a/src/evertz_fc/checks/evertz_fc_framestatus b/src/evertz_fc/checks/evertz_fc_framestatus new file mode 100644 index 0000000..e3c4a23 --- /dev/null +++ b/src/evertz_fc/checks/evertz_fc_framestatus @@ -0,0 +1,45 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth + +def inventory_evertz_fc_framestatus(info): + inventory = [] + for oidEnd, frameStatus in info: + inventory.append( ( "Frame Status", None ) ) + return inventory + +def check_evertz_fc_framestatus(item, _no_params, info): + status = 0 + for oidEnd, frameStatus in info: + ledStates = [ "-", "Off", "On", "n/a" ] + frameLed = ledStates[int(frameStatus)] + + # 1 = LED off / 2 = LED on / 3 = readout not supported + message = "Frame LED: %s" % ( frameLed ) + + if frameLed != "On": + status = 1 + + return status, message + + return 3, "%s not found in SNMP data." % item + +check_info["evertz_fc_framestatus"] = { + "check_function" : check_evertz_fc_framestatus, + "inventory_function" : inventory_evertz_fc_framestatus, + "service_description" : "%s", + "snmp_info" : (".1.3.6.1.4.1.6827.10", ["17.4", "216.4", "232.4"], [ + OID_END, + 2, #frameStatus + ]), + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.4.1.6827.10.17.2.1.0") or + oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.6827.10.216") or + oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.6827.10.232"), + "has_perfdata" : False +} diff --git a/src/evertz_fc/checks/evertz_fc_psu b/src/evertz_fc/checks/evertz_fc_psu new file mode 100644 index 0000000..9dcaf24 --- /dev/null +++ b/src/evertz_fc/checks/evertz_fc_psu @@ -0,0 +1,53 @@ +#!/usr/bin/python +# -*- coding: utf-8; py-indent-offset: 4 -*- +# _______ __ _ ____ __ +# | | \ | |___ \ / / +# | | \| | __) | / /-,_ +# | | |\ |/ __/ /__ _| +# |_______|_| \__|_____| |_| +# +# @author Markus Birth + +def inventory_evertz_fc_psu(info): + inventory = [] + # psu1 = right one + # psu2 = left one + # 1 = Off/missing / 2 = On / 3 = not supported + for oidend, frameStatus, psu1Status, psu2Status in info: + inventory.append( ( "PSU Status", None ) ) + return inventory + +def check_evertz_fc_psu(item, _no_params, info): + status = 0 + for oidend, frameStatus, psu1Status, psu2Status in info: + # n/a = not supported by hardware + ledStates = [ "-", "Off", "On", "n/a" ] + frameLed = ledStates[int(frameStatus)] + psu1Led = ledStates[int(psu1Status)] + psu2Led = ledStates[int(psu2Status)] + + # 1 = PSU LED off / 2 = PSU LED on / 3 = readout not supported + message = "PSU1 LED: %s, PSU2 LED: %s" % ( psu1Led, psu2Led ) + + if frameLed == "Off" and ( psu1Led == "Off" or psu2Led == "Off" ): + status = 1 + + return status, message + + return 3, "%s not found in SNMP data." % item + +check_info["evertz_fc_psu"] = { + "check_function" : check_evertz_fc_psu, + "inventory_function" : inventory_evertz_fc_psu, + "service_description" : "%s", + "snmp_info" : (".1.3.6.1.4.1.6827.10", ["17.4", "216.4", "232.4"], [ + OID_END, + 2, #frameStatus + 3, #psu1Status + 4, #psu2Status + ]), + "snmp_scan_function" : lambda oid: oid(".1.3.6.1.4.1.6827.10.17.2.1.0") or + oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.6827.10.216") or + oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.6827.10.232"), + "has_perfdata" : False +}