diff --git a/agent_based/cisco_asa_sensors.py b/agent_based/cisco_asa_sensors.py index 5941c7caedadc25139b84d397845ff8905e3cc6e..f50cbd0b6e15b8a52036faf8d945417e1d2b0e81 100644 --- a/agent_based/cisco_asa_sensors.py +++ b/agent_based/cisco_asa_sensors.py @@ -9,17 +9,110 @@ # # Monitor Cisco ASA temperature sensors # -# this check is based on the cmk 2.0 checkpoint_temp check -# # 2021-02-25: rewrite for CMK 2.x # # sample snmpwalk +# .1.3.6.1.2.1.47.1.1.1.1.7.1 = STRING: "Chassis" +# .1.3.6.1.2.1.47.1.1.1.1.7.2 = STRING: "Processor 0/0" +# .1.3.6.1.2.1.47.1.1.1.1.7.3 = STRING: "Processor 0/1" +# .1.3.6.1.2.1.47.1.1.1.1.7.4 = STRING: "Processor 0/2" +# .1.3.6.1.2.1.47.1.1.1.1.7.5 = STRING: "ASA5515 Slot for Removable Drive 0" +# .1.3.6.1.2.1.47.1.1.1.1.7.6 = STRING: "Micron_M550_MTFDDAK128MAY Removable Drive in Slot 0" +# .1.3.6.1.2.1.47.1.1.1.1.7.7 = STRING: "Chassis Cooling Fan 1" +# .1.3.6.1.2.1.47.1.1.1.1.7.8 = STRING: "Chassis Fan Sensor 1" +# .1.3.6.1.2.1.47.1.1.1.1.7.9 = STRING: "Chassis Cooling Fan 2" +# .1.3.6.1.2.1.47.1.1.1.1.7.10 = STRING: "Chassis Fan Sensor 2" +# .1.3.6.1.2.1.47.1.1.1.1.7.11 = STRING: "Chassis Cooling Fan 3" +# .1.3.6.1.2.1.47.1.1.1.1.7.12 = STRING: "Chassis Fan Sensor 3" +# .1.3.6.1.2.1.47.1.1.1.1.7.13 = STRING: "CPU Temperature Sensor 0/0" +# .1.3.6.1.2.1.47.1.1.1.1.7.14 = STRING: "Chassis Ambient Temperature Sensor 1" +# .1.3.6.1.2.1.47.1.1.1.1.7.15 = STRING: "Chassis Ambient Temperature Sensor 2" +# .1.3.6.1.2.1.47.1.1.1.1.7.16 = STRING: "Chassis Ambient Temperature Sensor 3" +# .1.3.6.1.2.1.47.1.1.1.1.7.17 = STRING: "Gi0/0" +# .1.3.6.1.2.1.47.1.1.1.1.7.18 = STRING: "Gi0/1" +# .1.3.6.1.2.1.47.1.1.1.1.7.19 = STRING: "Gi0/2" +# .1.3.6.1.2.1.47.1.1.1.1.7.20 = STRING: "Gi0/3" +# .1.3.6.1.2.1.47.1.1.1.1.7.21 = STRING: "Gi0/4" +# .1.3.6.1.2.1.47.1.1.1.1.7.22 = STRING: "Gi0/5" +# .1.3.6.1.2.1.47.1.1.1.1.7.23 = STRING: "In0/0" +# .1.3.6.1.2.1.47.1.1.1.1.7.24 = STRING: "In0/1" +# .1.3.6.1.2.1.47.1.1.1.1.7.25 = STRING: "Ma0/0" +# .1.3.6.1.2.1.47.1.1.1.1.7.26 = STRING: "Po1" +# +# .1.3.6.1.2.1.99.1.1.1.1.8 = INTEGER: 10 +# .1.3.6.1.2.1.99.1.1.1.1.10 = INTEGER: 10 +# .1.3.6.1.2.1.99.1.1.1.1.12 = INTEGER: 10 +# .1.3.6.1.2.1.99.1.1.1.1.13 = INTEGER: 8 +# .1.3.6.1.2.1.99.1.1.1.1.14 = INTEGER: 8 +# .1.3.6.1.2.1.99.1.1.1.1.15 = INTEGER: 8 +# .1.3.6.1.2.1.99.1.1.1.1.16 = INTEGER: 8 +# .1.3.6.1.2.1.99.1.1.1.4.8 = INTEGER: 7680 +# .1.3.6.1.2.1.99.1.1.1.4.10 = INTEGER: 7936 +# .1.3.6.1.2.1.99.1.1.1.4.12 = INTEGER: 7680 +# .1.3.6.1.2.1.99.1.1.1.4.13 = INTEGER: 34 +# .1.3.6.1.2.1.99.1.1.1.4.14 = INTEGER: 32 +# .1.3.6.1.2.1.99.1.1.1.4.15 = INTEGER: 30 +# .1.3.6.1.2.1.99.1.1.1.4.16 = INTEGER: 33 +# .1.3.6.1.2.1.99.1.1.1.5.8 = INTEGER: 1 +# .1.3.6.1.2.1.99.1.1.1.5.10 = INTEGER: 1 +# .1.3.6.1.2.1.99.1.1.1.5.12 = INTEGER: 1 +# .1.3.6.1.2.1.99.1.1.1.5.13 = INTEGER: 1 +# .1.3.6.1.2.1.99.1.1.1.5.14 = INTEGER: 1 +# .1.3.6.1.2.1.99.1.1.1.5.15 = INTEGER: 1 +# .1.3.6.1.2.1.99.1.1.1.5.16 = INTEGER: 1 +# .1.3.6.1.2.1.99.1.1.1.6.8 = STRING: "rpm" +# .1.3.6.1.2.1.99.1.1.1.6.10 = STRING: "rpm" +# .1.3.6.1.2.1.99.1.1.1.6.12 = STRING: "rpm" +# .1.3.6.1.2.1.99.1.1.1.6.13 = STRING: "celsius" +# .1.3.6.1.2.1.99.1.1.1.6.14 = STRING: "celsius" +# .1.3.6.1.2.1.99.1.1.1.6.15 = STRING: "celsius" +# .1.3.6.1.2.1.99.1.1.1.6.16 = STRING: "celsius" + +# +# sample string_table +# [ +# [ +# ['Chassis', '', '', '', ''], +# ['Processor 0/0', '', '', '', ''], +# ['Processor 0/1', '', '', '', ''], +# ['Processor 0/2', '', '', '', ''], +# ['ASA5515 Slot for Removable Drive 0', '', '', '', ''], +# ['Micron_M550_MTFDDAK128MAY Removable Drive in Slot 0', '', '', '', ''], +# ['Chassis Cooling Fan 1', '', '', '', ''], +# ['Chassis Fan Sensor 1', '10', '7680', '1', 'rpm'], +# ['Chassis Cooling Fan 2', '', '', '', ''], +# ['Chassis Fan Sensor 2', '10', '7936', '1', 'rpm'], +# ['Chassis Cooling Fan 3', '', '', '', ''], +# ['Chassis Fan Sensor 3', '10', '7680', '1', 'rpm'], +# ['CPU Temperature Sensor 0/0', '8', '34', '1', 'celsius'], +# ['Chassis Ambient Temperature Sensor 1', '8', '32', '1', 'celsius'], +# ['Chassis Ambient Temperature Sensor 2', '8', '30', '1', 'celsius'], +# ['Chassis Ambient Temperature Sensor 3', '8', '33', '1', 'celsius'], +# ['Gi0/0', '', '', '', ''], +# ['Gi0/1', '', '', '', ''], +# ['Gi0/2', '', '', '', ''], +# ['Gi0/3', '', '', '', ''], +# ['Gi0/4', '', '', '', ''], +# ['Gi0/5', '', '', '', ''], +# ['In0/0', '', '', '', ''], +# ['In0/1', '', '', '', ''], +# ['Ma0/0', '', '', '', ''], +# ['Po1', '', '', '', ''] +# ] +# ] # # sample section -# +# {'fan': {'Chassis Sensor 1': CiscoAsaSensor(value=7680, status=<State.OK: 0>, state_readable='Ok', unit='rpm'), +# 'Chassis Sensor 2': CiscoAsaSensor(value=7936, status=<State.OK: 0>, state_readable='Ok', unit='rpm'), +# 'Chassis Sensor 3': CiscoAsaSensor(value=7680, status=<State.OK: 0>, state_readable='Ok', unit='rpm')}, +# 'temp': {'CPU Sensor 0/0': CiscoAsaSensor(value=34.0, status=<State.OK: 0>, state_readable='Ok', unit='celsius'), +# 'Chassis Ambient Sensor 1': CiscoAsaSensor(value=32.0, status=<State.OK: 0>, state_readable='Ok', unit='celsius'), +# 'Chassis Ambient Sensor 2': CiscoAsaSensor(value=30.0, status=<State.OK: 0>, state_readable='Ok', unit='celsius'), +# 'Chassis Ambient Sensor 3': CiscoAsaSensor(value=33.0, status=<State.OK: 0>, state_readable='Ok', unit='celsius')}, +# 'power': {}} # -from typing import Mapping, Dict, List, Tuple, NamedTuple +from typing import Dict, List, NamedTuple from .agent_based_api.v1.type_defs import ( DiscoveryResult, @@ -30,14 +123,11 @@ from .agent_based_api.v1.type_defs import ( from .agent_based_api.v1 import ( register, Service, - equals, Result, check_levels, State, SNMPTree, startswith, - all_of, - any_of, ) @@ -147,7 +237,7 @@ from .utils.temperature import ( def discovery_cisco_asa_temp(section: Dict) -> DiscoveryResult: for key in section['temp']: - yield Service(item=key) # , parameters={'asgNetIfSpeed': section[item].asgNetIfSpeed}) + yield Service(item=key) def check_cisco_asa_temp(item, params: TempParamType, section) -> CheckResult: @@ -191,7 +281,7 @@ def render_rpm(value) -> str: def discovery_cisco_asa_fan(section: Dict) -> DiscoveryResult: for key in section['fan']: - yield Service(item=key) # , parameters={'asgNetIfSpeed': section[item].asgNetIfSpeed}) + yield Service(item=key) def check_cisco_asa_fan(item, params: TempParamType, section) -> CheckResult: @@ -232,7 +322,7 @@ register.check_plugin( def discovery_cisco_asa_power(section: Dict) -> DiscoveryResult: for key in section['power']: - yield Service(item=key) # , parameters={'asgNetIfSpeed': section[item].asgNetIfSpeed}) + yield Service(item=key) def check_cisco_asa_power(item, params: TempParamType, section) -> CheckResult: diff --git a/cisco_asa_sensors.mkp b/cisco_asa_sensors.mkp index c57df0a1c356b94f1ac4775086c972014b899072..f097b69c596434aa0b758e9b0b19071f887e816c 100644 Binary files a/cisco_asa_sensors.mkp and b/cisco_asa_sensors.mkp differ