From 4bd1357618cacf67480fced095f2b99c34153063 Mon Sep 17 00:00:00 2001 From: Robert Sander Date: Mon, 2 Dec 2024 16:17:06 +0100 Subject: [PATCH] Areca HBA SNMP checks for CMK 2.3 --- areca/agent_based/areca_hba_fans.py | 1 - areca/agent_based/areca_hba_ldisks.py | 8 -- areca/agent_based/areca_hba_pdisks.py | 142 ++++++++++++++--------- areca/agent_based/areca_hba_raidsets.py | 106 +++++++++-------- areca/agent_based/areca_hba_temp.py | 148 +++++++++--------------- areca/agent_based/areca_hba_voltages.py | 117 +++++++++++-------- areca/areca-2.0.2.mkp | Bin 0 -> 12832 bytes 7 files changed, 268 insertions(+), 254 deletions(-) create mode 100644 areca/areca-2.0.2.mkp diff --git a/areca/agent_based/areca_hba_fans.py b/areca/agent_based/areca_hba_fans.py index 18a0f2cf..23db514d 100644 --- a/areca/agent_based/areca_hba_fans.py +++ b/areca/agent_based/areca_hba_fans.py @@ -68,7 +68,6 @@ def check_areca_hba_fans(item, params, section) -> CheckResult: fetch = SNMPTree( base = ".1.3.6.1.4.1.18928.1.2.2.1.9.1", oids = [ - # "1", # hwControllerBoardFanIndex "2", # hwControllerBoardFanDesc "3", # hwControllerBoardFanSpeed ] diff --git a/areca/agent_based/areca_hba_ldisks.py b/areca/agent_based/areca_hba_ldisks.py index a74f0718..5769058b 100644 --- a/areca/agent_based/areca_hba_ldisks.py +++ b/areca/agent_based/areca_hba_ldisks.py @@ -10,7 +10,6 @@ # +------------------------------------------------------------------+ # # This file is an addon for Check_MK. -# The official homepage for this check is at http://bitbucket.org/darkfader # # check_mk is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -36,9 +35,6 @@ startswith, ) -from cmk.utils import debug -from pprint import pprint # type: ignore - def parse_areca_hba_ldisks(string_table): section = {} for vsf_id, vsf_name, vsf_rsf, vsf_size, vsf_state, vsf_rbld in string_table: @@ -49,9 +45,6 @@ def parse_areca_hba_ldisks(string_table): "state": vsf_state, "rbld": int(vsf_rbld) / 10.0, } - if debug.enabled(): - pprint(string_table) - pprint(section) return section def discover_areca_hba_ldisks(section) -> DiscoveryResult: @@ -79,7 +72,6 @@ def check_areca_hba_ldisks(item, section) -> CheckResult: name = "areca_hba_ldisks", parse_function = parse_areca_hba_ldisks, detect = startswith(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.18928.1"), - # detect = lambda oid: True, fetch = SNMPTree( base = ".1.3.6.1.4.1.18928.1.2.5.1.1", oids = [ diff --git a/areca/agent_based/areca_hba_pdisks.py b/areca/agent_based/areca_hba_pdisks.py index 255ead19..0314645b 100644 --- a/areca/agent_based/areca_hba_pdisks.py +++ b/areca/agent_based/areca_hba_pdisks.py @@ -10,7 +10,6 @@ # +------------------------------------------------------------------+ # # This file is an addon for Check_MK. -# The official homepage for this check is at http://bitbucket.org/darkfader # # check_mk is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -52,66 +51,95 @@ # | +-----field # +-------enclosure +max_enclosures = 8 +from cmk.agent_based.v2 import ( + CheckPlugin, + CheckResult, + DiscoveryResult, + Result, + Service, + SNMPSection, + SNMPTree, + State, + startswith, +) +from cmk.agent_based.v2.render import bytes -def inventory_areca_hba_pdisks(info): - inventory = [] - for enclosure_entry in info: - for slot_entry in enclosure_entry: - if len(slot_entry) == 8 and slot_entry[-1].split()[0] != "Empty": - enc, slot = slot_entry[0].split(".") - diskname = ("%d/%02d" % (int(enc), int(slot))) - inventory.append((diskname, None)) - return inventory +def parse_areca_hba_pdisks(string_table): + section = {} + slot_type = { + "1": "SATA", + "2": "SAS", + } + for encl in range(max_enclosures): + installed, desc = string_table[encl * 2][0] + if installed == "1": + section[encl + 1] = { + "name": desc, + "slots": {}, + } + for id, desc, name, serial, firmver, capacity, typ, state in string_table[encl * 2 + 1]: + if state != "Empty Slot": + section[encl + 1]["slots"][int(id)] = { + "desc": desc, + "name": name, + "serial": serial, + "firmver": firmver, + "capacity": int(capacity) * 1024 *1024, + "type": slot_type.get(typ), + "state": state, + } + return section -def check_areca_hba_pdisks(item, _no_params, info): - for enclosure_entry in info: - for slot_entry in enclosure_entry: - enc, slot = slot_entry[0].split(".") - diskname = ("%d/%02d" % (int(enc), int(slot))) +def discover_areca_hba_pdisks(section) -> DiscoveryResult: + for encl in section.keys(): + for slot in section[encl]["slots"].keys(): + yield Service(item="%d/%02d" % (encl, slot)) - # We could do smarter by tracking the serial at inventory. - # I decided to not get too smart, and so we're not following a disk - # around if you put it somewhere else. - if diskname == item: +def check_areca_hba_pdisks(item, section) -> CheckResult: + encl, slot = list(map(int, item.split("/"))) + if encl in section: + if slot in section[encl]["slots"]: + data = section[encl]["slots"][slot] + yield Result(state=State.OK, summary="%s %s %s (%s)" % (data["name"], data["serial"], data["firmver"], bytes(data["capacity"]))) + if data["state"] == "Failed": + yield Result(state=State.CRIT, summary="failed") - disk_descr = "(%s %s)" % (slot_entry[2], slot_entry[3]) +snmp_sections = [] +for encl in range(1, max_enclosures + 1): + snmp_sections.append(SNMPTree( + base = f".1.3.6.1.4.1.18928.1.2.3.{encl}", + oids = [ + "1.0", # ARECA-SNMP-MIB::hddEnclosureNNInstalled + "2.0", # ARECA-SNMP-MIB::hddEnclosureNNDescription + ], + )) + snmp_sections.append(SNMPTree( + base = f".1.3.6.1.4.1.18928.1.2.3.{encl}.4.1", + oids = [ + "1", # ARECA-SNMP-MIB::hddEnclosureNNSlots + "2", # ARECA-SNMP-MIB::hddEnclosureNNDesc + "3", # ARECA-SNMP-MIB::hddEnclosureNNName + "4", # ARECA-SNMP-MIB::hddEnclosureNNSerial + "5", # ARECA-SNMP-MIB::hddEnclosureNNFirmVer + "6", # ARECA-SNMP-MIB::hddEnclosureNNCapacity + "7", # ARECA-SNMP-MIB::hddEnclosureNNType + "8", # ARECA-SNMP-MIB::hddEnclosureNNState + ], + )) - # What I'm checking here is a field that SEEMS to be the right one. - # Contact me if this seems wrong. Someone needs to test / adjust it - # with some JBOD mode array and pull some disks. - if slot_entry[7] == "Failed": - return (2, "CRIT - Disk is failed. %s" % disk_descr) - else: - return (0, "OK - Disk is OK. %s" % disk_descr) - - return (3, "Disk not found in agent output") - - -# check_info["areca_hba_pdisks"] = { -# "check_function" : check_areca_hba_pdisks, -# "inventory_function" : inventory_areca_hba_pdisks, -# "has_perfdata" : False, -# "service_description" : "PDisk Enc/Sl %s", -# # Find Areca SAS MIB -# "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"), -# "snmp_info" : [(".1.3.6.1.4.1.18928.1.2.3", -# # unclear: how does it look in jbod mode? -# # where does i get pony? -# # There's up to 8 enclosures, "1" is hardcoded having 8 slots. -# # probably it's the ext. SAS connector. -# [ "1", "2", "3", "4", "5", "6", "7", "8" ], -# # Below each enclosure there's the following structure for disk data -# [ "4.1.1", # The slot ids -# "4.1.2", # The slot descrs -# "4.1.3", # The disk model -# "4.1.4", # The disk fw -# "4.1.5", # The disk size -# # The MIB seems wrong about the next ones -# "4.1.6", # -# "4.1.7", # -# "4.1.8", # Textual disk state -# ] -# )], -# } +snmp_section_areca_hba_pdisks = SNMPSection( + name = "areca_hba_pdisks", + parse_function = parse_areca_hba_pdisks, + detect = startswith(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.18928.1"), + fetch = snmp_sections, +) +check_plugin_areca_hba_pdisks = CheckPlugin( + name = "areca_hba_pdisks", + sections = ["areca_hba_pdisks"], + service_name = "PDisk Enc/Sl %s", + discovery_function = discover_areca_hba_pdisks, + check_function = check_areca_hba_pdisks, +) \ No newline at end of file diff --git a/areca/agent_based/areca_hba_raidsets.py b/areca/agent_based/areca_hba_raidsets.py index 58c469e0..35351395 100644 --- a/areca/agent_based/areca_hba_raidsets.py +++ b/areca/agent_based/areca_hba_raidsets.py @@ -10,7 +10,6 @@ # +------------------------------------------------------------------+ # # This file is an addon for Check_MK. -# The official homepage for this check is at http://bitbucket.org/darkfader # # check_mk is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,55 +23,68 @@ # Boston, MA 02110-1301 USA. -def inventory_areca_hba_raidsets(info): - inventory = [] +from cmk.agent_based.v2 import ( + CheckPlugin, + CheckResult, + DiscoveryResult, + Result, + Service, + SimpleSNMPSection, + SNMPTree, + State, + startswith, +) - # not sure why i end up with my info double stacked - # but i'm sure it's me. - for line in info[0]: - if len(line) == 5: - rs_id, rs_name, rs_state, rs_mem_sz, rs_mem_names = line - inventory.append((rs_id, None)) - return inventory -def check_areca_hba_raidsets(item, _no_params, info): - for line in info[0]: - rs_id, rs_name, rs_state, rs_mem_sz, rs_mem_names = line +def parse_areca_hba_raidsets(string_table): + section = {} + for id, name, state, members in string_table: + section[id] = { + "name": name, + "state": state, + "members": members, + } + return section - if rs_id == item: - if rs_state == "Normal": - state = 0 - elif rs_state == "Rebuilding": - state = 1 - # I hope Offline is correct. - elif rs_state in [ "Degraded", "Offline" ]: - state = 2 - # Any state we don't know. - else: - state = 3 +def discover_areca_hba_raidsets(section) -> DiscoveryResult: + for id in section.keys(): + yield Service(item=id) - msg = "%s is %s. (members: %s)" % (rs_name, rs_state, rs_mem_names) - return (state, msg) - - return (3, "UNKW - Raidset not found in agent output") +def check_areca_hba_raidsets(item, section) -> CheckResult: + if item in section: + data = section[item] + if data["state"] == "Normal": + state = State.OK + elif data["state"] == "Rebuilding": + state = State.WARN + elif data["state"] in ["Degraded", "Offline"]: + state = State.CRIT + else: + state = State.UNKNOWN + yield Result( + state=state, + summary="%s is %s, members: %s" % (data["name"], data["state"], data["members"]) + ) +snmp_section_areca_hba_raidsets = SimpleSNMPSection( + name="areca_hba_raidsets", + parse_function=parse_areca_hba_raidsets, + detect = startswith(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.18928.1"), + fetch = SNMPTree( + base=".1.3.6.1.4.1.18928.1.2.4.1.1", + oids=[ + "1", # ARECA-SNMP-MIB::raidNumber + "2", # ARECA-SNMP-MIB::raidName + "4", # ARECA-SNMP-MIB::raidState + "8", # ARECA-SNMP-MIB::raidMemberDiskChannels + ], + ), +) -# check_info["areca_hba_raidsets"] = { -# "check_function" : check_areca_hba_raidsets, -# "inventory_function" : inventory_areca_hba_raidsets, -# "has_perfdata" : False, -# "service_description" : "Raid set %s", -# # Find Areca SAS MIB -# "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"), -# "snmp_info" : [(".1.3.6.1.4.1.18928.1.2.4.1.1", -# # Below each enclosure there's the following structure for disk data -# [ #"2", "4" -# "1", # Raidset id -# "2", # Raidset name -# "4", # Raidset State -# "7", # Member disk size -# "8", # Member disk names and states -# ] -# )], -# } - +check_plugin_areca_hba_raidsets = CheckPlugin( + name="areca_hba_raidsets", + sections=["areca_hba_raidsets"], + service_name="Raid set %s", + discovery_function=discover_areca_hba_raidsets, + check_function=check_areca_hba_raidsets, +) \ No newline at end of file diff --git a/areca/agent_based/areca_hba_temp.py b/areca/agent_based/areca_hba_temp.py index 70037608..9f123ca2 100644 --- a/areca/agent_based/areca_hba_temp.py +++ b/areca/agent_based/areca_hba_temp.py @@ -10,7 +10,6 @@ # +------------------------------------------------------------------+ # # This file is an addon for Check_MK. -# The official homepage for this check is at http://bitbucket.org/darkfader # # check_mk is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,54 +23,6 @@ # Boston, MA 02110-1301 USA. -# A check for hardware stuff on Areca raid controllers. - -# model, serial, firmware (actually 3 firmwares, but one should do?) -#SNMPv2-SMI::enterprises.18928.1.2.1.1.0 = STRING: "ARC-1680" -#SNMPv2-SMI::enterprises.18928.1.2.1.3.0 = STRING: "Y952CABVAR601133" -#SNMPv2-SMI::enterprises.18928.1.2.1.4.0 = STRING: "V1.49 2010-12-02" -# -# -# Voltages and battery -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.1 = INTEGER: 1 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.2 = INTEGER: 2 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.3 = INTEGER: 3 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.4 = INTEGER: 4 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.5 = INTEGER: 5 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.6 = INTEGER: 6 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.7 = INTEGER: 7 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.8 = INTEGER: 8 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.1.9 = INTEGER: 9 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.1 = STRING: "12V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.2 = STRING: "5V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.3 = STRING: "3.3V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.4 = STRING: "DDR-II +1.8V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.5 = STRING: "PCI-E +1.8V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.6 = STRING: "CPU +1.8V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.7 = STRING: "CPU +1.2V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.8 = STRING: "DDR-II +0.9V" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.2.9 = STRING: "Battery Status" -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.1 = INTEGER: 11977 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.2 = INTEGER: 5026 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.3 = INTEGER: 3296 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.4 = INTEGER: 1808 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.5 = INTEGER: 1808 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.6 = INTEGER: 1824 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.7 = INTEGER: 1184 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.8 = INTEGER: 896 -#.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.9 = INTEGER: 255 - -#snmp_info : oid(".1.3.6.1.4.1.18928.1.2.2.1.8.1"), [ "1", "2", "3" ] - -# Fans - -#.1.3.6.1.4.1.18928.1.2.2.1.9.1.1.1 = INTEGER: 1 -#.1.3.6.1.4.1.18928.1.2.2.1.9.1.2.1 = STRING: "CPU Fan" -#.1.3.6.1.4.1.18928.1.2.2.1.9.1.3.1 = INTEGER: 0 - -# snmp_info : oid(".1.3.6.1.4.1.18928.1.2.2.1.9.1"), [ "1", "2", "3" ] - - # Temperature #.1.3.6.1.4.1.18928.1.2.2.1.10.1.1.1 = INTEGER: 1 @@ -81,47 +32,58 @@ #.1.3.6.1.4.1.18928.1.2.2.1.10.1.3.1 = INTEGER: 80 #.1.3.6.1.4.1.18928.1.2.2.1.10.1.3.2 = INTEGER: 35 -# snmp_info : oid(".1.3.6.1.4.1.18928.1.2.2.1.10.1"), [ "1", "2", "3" ] -# default levels will not work well in this check -areca_hba_temp_default_levels = (63, 69) -def inventory_areca_hba_temp(info): - inventory = [] - for line in info[0]: - # Break out the sensor name, removing "Temperature or "temp" - if "temp" in line[1].lower(): - # if the name is not the first word, you can loop over the parts here. - sensor = line[1].split(" ")[0] - else: - sensor = line[1] - inventory.append((sensor, "areca_hba_temp_default_levels")) - return inventory - - -def check_areca_hba_temp(item, params, info): - for line in info[0]: - if line[1].startswith(item): - warn, crit = params - temp = saveint(line[2]) - if temp > crit: - state = 2 - elif temp > warn: - state = 1 - else: - state = 0 - - perfdata = [ ( "temp", temp, warn, crit ) ] - return (state, "Temperature is %dC" % temp, perfdata) - - return (3, "UNKNOWN - sensor not found in agent output") - - -# check_info["areca_hba_temp"] = { -# "check_function" : check_areca_hba_temp, -# "inventory_function" : inventory_areca_hba_temp, -# "has_perfdata" : True, -# "service_description" : "Temperature %s", -# # Find Areca SAS MIB -# "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"), -# "snmp_info" : [(".1.3.6.1.4.1.18928.1.2.2.1.10.1", [ "1", "2", "3" ])], -# } - +from cmk.agent_based.v2 import ( + CheckPlugin, + CheckResult, + DiscoveryResult, + Result, + Service, + SimpleSNMPSection, + SNMPTree, + State, + startswith, +) +from cmk.plugins.lib import temperature + + +def parse_areca_hba_temp(string_table): + section = {} + for name, temp in string_table: + newname = [] + for namepart in name.split(): + if "temp" not in namepart.lower(): + newname.append(namepart) + section[" ".join(newname)] = int(temp) + return section + +def discover_areca_hba_temp(section) -> DiscoveryResult: + for name in section.keys(): + yield Service(item=name) + +def check_areca_hba_temp(item, params, section) -> CheckResult: + if item in section: + temp = section[item] + yield from temperature.check_temperature(temp, params) + +snmp_section_areca_hba_temp = SimpleSNMPSection( + name="areca_hba_temp", + parse_function=parse_areca_hba_temp, + detect = startswith(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.18928.1"), + fetch = SNMPTree( + base=".1.3.6.1.4.1.18928.1.2.2.1.10.1", + oids=[ + "2", # ARECA-SNMP-MIB::hwControllerBoardTempDesc + "3", # ARECA-SNMP-MIB::hwControllerBoardTempValue + ], + ), +) + +check_plugin_areca_hba_temp = CheckPlugin( + name="areca_hba_temp", + sections=["areca_hba_temp"], + service_name="Temperature %s", + discovery_function=discover_areca_hba_temp, + check_function=check_areca_hba_temp, + check_default_parameters={}, + check_ruleset_name="temperature", +) \ No newline at end of file diff --git a/areca/agent_based/areca_hba_voltages.py b/areca/agent_based/areca_hba_voltages.py index a12f4d9d..02eb55fe 100644 --- a/areca/agent_based/areca_hba_voltages.py +++ b/areca/agent_based/areca_hba_voltages.py @@ -10,7 +10,6 @@ # +------------------------------------------------------------------+ # # This file is an addon for Check_MK. -# The official homepage for this check is at http://bitbucket.org/darkfader # # check_mk is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -56,8 +55,6 @@ #.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.8 = INTEGER: 896 #.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.9 = INTEGER: 255 -#snmp_info : oid(".1.3.6.1.4.1.18928.1.2.2.1.8.1"), [ "1", "2", "3" ] - # Turn this into something much sweeter. # The battery status doesnt really belong in here. #{'voltages': {'12V': 11977, @@ -65,54 +62,78 @@ # '5V': 5053, # 'PCI-E +1.8V': 1808}} -def parse_areca(info, what): - areca_info = {} - areca_info[what] = {} - for line in info[0]: - if len(line) == 3: - id, sensor_name, value = line - # remove spaces from the sensor name - if len(sensor_name.split()) > 1: - s_parts = sensor_name.split() - sensor_name = s_parts[0] + " " + s_parts[-1] - areca_info[what][sensor_name] = saveint(value) - return areca_info - -def inventory_areca_hba_voltages(info): - inventory = [] +from cmk.agent_based.v2 import ( + CheckPlugin, + CheckResult, + DiscoveryResult, + Result, + Service, + SimpleSNMPSection, + SNMPTree, + State, + startswith, +) +from cmk.plugins.lib.elphase import check_elphase - areca_info = parse_areca(info, "voltages") - for sensor_name in areca_info["voltages"].keys(): - # Skip the battery sensor, I dont have one, impossible to - # make the check match for it. - if sensor_name.lower() != "battery status": - inventory.append((sensor_name, None)) - return inventory +def parse_areca_hba_voltages(string_table): + epsilon = 10 # allowed deviation in percent + section = {} + for id, desc, value in string_table: + try: + rated = float(desc.split()[-1].replace("V", "")) + except ValueError: + rated = None + section[id] = { + "desc": desc, + "rated": rated, + "value": float(value) / 1000.0, + } + if rated: + section[id]["rated_lower"] = rated - rated / 100 * epsilon + section[id]["rated_upper"] = rated + rated / 100 * epsilon + return section -def check_areca_hba_voltages(item, _no_params, info): - areca_info = parse_areca(info, "voltages") - epsilon = 10 - if item in areca_info["voltages"].keys(): - # i'm fetching the voltage from the label and try to alert on the difference. - v_cur = float(areca_info["voltages"][item]) / 1000.0 - v_rated = float(item.split()[-1].replace("V", "")) - perfdata = [ ( "voltage", v_cur ) ] - # this is now just a hardcoded level, could be improved. - if v_cur < v_rated - v_rated / 100*epsilon or v_cur > v_rated + v_rated / 100*epsilon: - return (1, "WARNING - Voltage is %02.3fV" % v_cur, perfdata) - else: - return (0, "OK - Voltage is ok", perfdata) - return (3, "UNKNOWN - Voltage sensor not found in agent output") +def discover_areca_hba_voltages(section) -> DiscoveryResult: + for id in section.keys(): + yield Service(item=id) +def check_areca_hba_voltages(item, params, section) -> CheckResult: + if item in section: + epsilon = 10 + yield Result(state=State.OK, summary=section[item]["desc"]) + voltage = section[item]["value"] + rated = section[item]["rated"] + if rated: + if voltage < section[item]["rated_lower"] or voltage > section[item]["rated_upper"]: + voltage = (voltage, (1, "Voltage is out of range (%.1f V - %.1f V)" % (section[item]["rated_lower"], section[item]["rated_upper"]))) + data = { + item: { + "voltage": voltage, + } + } + yield from check_elphase(item, params, data) -# check_info["areca_hba_voltages"] = { -# "check_function" : check_areca_hba_voltages, -# "inventory_function" : inventory_areca_hba_voltages, -# "has_perfdata" : True, -# "service_description" : "Voltage %s", -# # Find Areca SAS MIB -# "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"), -# "snmp_info" : [(".1.3.6.1.4.1.18928.1.2.2.1.8.1", [ "1", "2", "3" ])], -# } +snmp_section_areca_hba_voltages = SimpleSNMPSection( + name="areca_hba_voltages", + parse_function=parse_areca_hba_voltages, + detect = startswith(".1.3.6.1.2.1.1.2.0", ".1.3.6.1.4.1.18928.1"), + fetch = SNMPTree( + base=".1.3.6.1.4.1.18928.1.2.2.1.8.1", + oids=[ + "1", # ARECA-SNMP-MIB::hwControllerBoardVolIndex + "2", # ARECA-SNMP-MIB::hwControllerBoardVolDesc + "3", # ARECA-SNMP-MIB::hwControllerBoardVolValue + ], + ), +) +check_plugin_areca_hba_voktages = CheckPlugin( + name="areca_hba_voltages", + sections=["areca_hba_voltages"], + service_name="Voltage %s", + discovery_function=discover_areca_hba_voltages, + check_function=check_areca_hba_voltages, + check_default_parameters={}, + check_ruleset_name="el_inphase", +) \ No newline at end of file diff --git a/areca/areca-2.0.2.mkp b/areca/areca-2.0.2.mkp new file mode 100644 index 0000000000000000000000000000000000000000..4bd74477057c91b83a0959132050dfd413392799 GIT binary patch literal 12832 zcmb7qWmFqsw>6~&ij^Y4rMLvw;%#wv_n-w@+^sEANPyx_af$?Y*Wm8%?(TB)w%@vU z-L>wY?@!LmIeVYI=VaDoR-T6f@*3f8NWl{E`7qVbZJxJ&`@Y0UartGjrz1$oT;kR1 zh^tiR5>vr2JDYAB{#|D-5s^yq`4s8Qxa<_qxyEax)@3~DA7BYeH&|j94(f`>$vp(? zV_)J@{c_RG&ba@Mz_Z-1HKU2{4M7FIcc1FNV@MC__g` zT)NfPwBIy?!p6ElGLPQcniOt}^{}{q`!MdeI6vep|2%)WU6Htt)D-zR4msjF0h!&4 z4JRUn3!0y@9g|UDES}Dgm#eilA$53p-SncQrJfSXFXZFal9%pmXY9`!Z_S9!TecYr zy$oE3eYeD7SEJU$%4cJ*nyHbaM<*s} zS@$SSFZS!}!08~T;jG_D=4QD+_{n-K#jCZuXJ5wb&?PNFL z3G;b7@bDPVc5FqGuzV48w6Qs#Cx+SnbP*LlceycM^(gg$1piP_L}_n|XkJ8NeV9PZ zbCh`W?4rbS{g#Xc;CZ)>4snT!uRK)n-zVv>kz%_|+`lK;Pr`>RCkvMcSpVt^=%Sv2 zrqSfjj?->REN;o*pda)e$l!p35RWD`SgQzdx9Omj{*d(!e*@m2!{5IfeH|_XH7+NT zW}sCk+3uStitJl|+9OZaRyKlv1w5?1{9-?vhwk-AKJfcMA!WD9@_D&#eKw2z)!wCD zrG7#p&x1IbLdh_93_AODQF57&a2oO(n=VUd{oAvHhQU+O1N*$E{l|W{Kl|f;Z?9B7 zJ`;&ckvvX=pY~52ax0b@F}PB{{tT13K%|J;nGT)HvWzG2>St>3Q^Xy-azQ*SoR~Qq zv-zBQ3CP?7;!SWm=6@m?MaENLsXRU52MR|INIs~(Co(U#*sgfr85V~ckyYY^s4zm8J!Etw?pXEN??EyzbU5)R0kvQZVRfXz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