diff --git a/agent_based/ospf_neighbor.py b/agent_based/ospf_neighbor.py index 186f5e2bdc49d8d7d2ea723673a9d395bf63f721..3a2351001cb3aedd4031fe7c830df0a866bf4480 100644 --- a/agent_based/ospf_neighbor.py +++ b/agent_based/ospf_neighbor.py @@ -40,30 +40,41 @@ ############################################################################### # Example Agent Output: -# OSPF-MIB - -# 1.3.6.1.2.1.14.10.1.1.172.20.2.214.0 = IpAddress: 172.20.2.214 -# 1.3.6.1.2.1.14.10.1.2.172.20.2.214.0 = INTEGER: 0 -# 1.3.6.1.2.1.14.10.1.3.172.20.2.214.0 = IpAddress: 192.168.1.2 -# 1.3.6.1.2.1.14.10.1.4.172.20.2.214.0 = INTEGER: 2 -# 1.3.6.1.2.1.14.10.1.5.172.20.2.214.0 = INTEGER: 1 -# 1.3.6.1.2.1.14.10.1.6.172.20.2.214.0 = INTEGER: 8 -# 1.3.6.1.2.1.14.10.1.7.172.20.2.214.0 = Counter32: 6 -# 1.3.6.1.2.1.14.10.1.8.172.20.2.214.0 = Gauge32: 0 -# 1.3.6.1.2.1.14.10.1.9.172.20.2.214.0 = INTEGER: 1 -# 1.3.6.1.2.1.14.10.1.10.172.20.2.214.0 = INTEGER: 1 -# 1.3.6.1.2.1.14.10.1.11.172.20.2.214.0 = INTEGER: 2 +# OSPF-MIB::ospfNbrEntry + +# .1.3.6.1.2.1.14.10.1.1.172.17.108.52.0 = IpAddress: 172.17.108.52 +# .1.3.6.1.2.1.14.10.1.1.172.17.108.60.0 = IpAddress: 172.17.108.60 +# .1.3.6.1.2.1.14.10.1.2.172.17.108.52.0 = INTEGER: 0 +# .1.3.6.1.2.1.14.10.1.2.172.17.108.60.0 = INTEGER: 0 +# .1.3.6.1.2.1.14.10.1.3.172.17.108.52.0 = IpAddress: 10.253.128.139 +# .1.3.6.1.2.1.14.10.1.3.172.17.108.60.0 = IpAddress: 10.253.128.139 +# .1.3.6.1.2.1.14.10.1.4.172.17.108.52.0 = INTEGER: 2 +# .1.3.6.1.2.1.14.10.1.4.172.17.108.60.0 = INTEGER: 2 +# .1.3.6.1.2.1.14.10.1.5.172.17.108.52.0 = INTEGER: 1 +# .1.3.6.1.2.1.14.10.1.5.172.17.108.60.0 = INTEGER: 1 +# .1.3.6.1.2.1.14.10.1.6.172.17.108.52.0 = INTEGER: 8 +# .1.3.6.1.2.1.14.10.1.6.172.17.108.60.0 = INTEGER: 8 +# .1.3.6.1.2.1.14.10.1.7.172.17.108.52.0 = Counter32: 6 +# .1.3.6.1.2.1.14.10.1.7.172.17.108.60.0 = Counter32: 6 +# .1.3.6.1.2.1.14.10.1.8.172.17.108.52.0 = Gauge32: 0 +# .1.3.6.1.2.1.14.10.1.8.172.17.108.60.0 = Gauge32: 0 +# .1.3.6.1.2.1.14.10.1.9.172.17.108.52.0 = INTEGER: 1 +# .1.3.6.1.2.1.14.10.1.9.172.17.108.60.0 = INTEGER: 1 +# .1.3.6.1.2.1.14.10.1.10.172.17.108.52.0 = INTEGER: 1 +# .1.3.6.1.2.1.14.10.1.10.172.17.108.60.0 = INTEGER: 1 +# .1.3.6.1.2.1.14.10.1.11.172.17.108.52.0 = INTEGER: 2 +# .1.3.6.1.2.1.14.10.1.11.172.17.108.60.0 = INTEGER: 2 # # sample parsed # { -# '172.17.108.52': {'helperage': '', 'prio': '1', 'permanence': 'dynamic', 'helperstatus': '', 'options': '2', -# 'state': '8', 'hellosup': 'false', 'helperexitreason': '', 'events': 6, 'rtrid': '10.250.128.130'}, -# '172.17.108.60': {'helperage': '', 'prio': '1', 'permanence': 'dynamic', 'helperstatus': '', 'options': '2', -# 'state': '8', 'hellosup': 'false', 'helperexitreason': '', 'events': 6, 'rtrid': '10.253.128.101'}, -# '172.17.108.58': {'helperage': '', 'prio': '1', 'permanence': 'dynamic', 'helperstatus': '', 'options': '2', -# 'state': '8', 'hellosup': 'false', 'helperexitreason': '', 'events': 12, 'rtrid': '172.17.0.2'}, -# '172.17.108.49': {'helperage': '', 'prio': '1', 'permanence': 'dynamic', 'helperstatus': '', 'options': '2', -# 'state': '8', 'hellosup': 'false', 'helperexitreason': '', 'events': 9, 'rtrid': '172.17.0.2'} +# '172.17.108.52': OspfNeighbor( +# rtrid='10.253.128.139', options='not a stub area', prio='1', state='8', events=6, +# permanence='dynamic', hellosup='false', helperstatus='', helperage='', helperexitreason='' +# ), +# '172.17.108.60': OspfNeighbor( +# rtrid='10.253.128.139', options='not a stub area', prio='1', state='8', events=6, +# permanence='dynamic', hellosup='false', helperstatus='', helperage='', helperexitreason='' +# ) # } # @@ -93,6 +104,7 @@ class OspfNeighbor: prio: str state: str events: int + lsretransqlen: int permanence: str hellosup: str helperstatus: str @@ -158,7 +170,7 @@ def parse_ospf_neighbor(string_table: StringTable) -> Dict[str, OspfNeighbor]: return options parsed = {} - for ip, rtrid, options, prio, state, events, permanence, hellosup, helperstatus, helperage, \ + for ip, rtrid, options, prio, state, events, lsretransqlen, permanence, hellosup, helperstatus, helperage, \ helperexitreason in string_table: parsed[ip] = OspfNeighbor( rtrid=rtrid, @@ -166,6 +178,7 @@ def parse_ospf_neighbor(string_table: StringTable) -> Dict[str, OspfNeighbor]: prio=prio, state=state, events=int(events), + lsretransqlen=int(lsretransqlen), permanence=ospf_nbr_permanence(str(permanence)), hellosup=ospf_nbr_hellosuppressed(hellosup), helperstatus=ospf_nbr_helperstatus(helperstatus), @@ -204,7 +217,7 @@ def check_ospf_neighbor(item, params, section: Dict[str, OspfNeighbor]) -> Check '8': 0, # full } - not_found_state = params['state_not_found', 3] + not_found_state = params['state_not_found'] for neighbour, neighbourAlias, neighbourNotFoundState in params.get('peer_list', []): if item == neighbour: @@ -221,9 +234,10 @@ def check_ospf_neighbor(item, params, section: Dict[str, OspfNeighbor]) -> Check neighborstate.update(params.get('neighborstate', neighborstate)) # update neighborstatus with params - yield Result(state=State(neighborstate.get(neighbor.state, 3)), summary=f'Status {ospf_nbr_state(neighbor.state)}') + yield Result(state=State(neighborstate.get(neighbor.state, 3)), summary=f'Status: {ospf_nbr_state(neighbor.state)}') yield Metric(value=neighbor.events, name='ospf_neighbor_ospf_events') + yield Metric(value=neighbor.lsretransqlen, name='ospf_neighbor_ospf_retransmission_queue_length') for text, value in [ ('options', neighbor.options), @@ -244,17 +258,18 @@ register.snmp_section( fetch=SNMPTree( base='.1.3.6.1.2.1.14.10.1', # OSPF-MIB::ospfNbrEntry oids=[ - '1', # 'ospfNbrIpAddr' - '3', # 'ospfNbrRtrId' - '4', # 'ospfNbrOptions' - '5', # 'ospfNbrPriority' - '6', # 'ospfNbrState - '7', # 'ospfNbrEvents' - '10', # 'ospfNbrPermanence' - '11', # 'ospfNbrHelloSuppressed' - '12', # 'ospfNbrRestartHelperStatus' - '13', # 'ospfNbrRestartHelperAge' - '14', # 'ospfNbrRestartHelperExitReason' + '1', # ospfNbrIpAddr + '3', # ospfNbrRtrId + '4', # ospfNbrOptions + '5', # ospfNbrPriority + '6', # ospfNbrStat + '7', # ospfNbrEvents + '8', # ospfNbrLSRetransQLen + '10', # ospfNbrPermanence + '11', # ospfNbrHelloSuppressed + '12', # ospfNbrRestartHelperStatus + '13', # ospfNbrRestartHelperAge + '14', # ospfNbrRestartHelperExitReason ] ), detect=exists('.1.3.6.1.2.1.14.10.1.1.*') diff --git a/ospf_neighbor.mkp b/ospf_neighbor.mkp index 825399809418c202d2535f282c00a9c8f9b7debe..bb13a13727b2dbf2cb47615687ef6363353c9f83 100644 Binary files a/ospf_neighbor.mkp and b/ospf_neighbor.mkp differ diff --git a/web/plugins/metrics/ospf_neighbor.py b/web/plugins/metrics/ospf_neighbor.py index 5ed4d45e87fdabc7cac868a9224380f8e7286a67..b82044ffd2c678f3915907e474710cd038bccedd 100644 --- a/web/plugins/metrics/ospf_neighbor.py +++ b/web/plugins/metrics/ospf_neighbor.py @@ -23,9 +23,16 @@ from cmk.gui.plugins.metrics import ( metric_info['ospf_neighbor_ospf_events'] = { 'title': _('Events'), 'unit': 'count', - 'color': '26/a', + 'color': '16/a', } +metric_info['ospf_neighbor_ospf_retransmission_queue_length'] = { + 'title': _('Retransmission queue length'), + 'unit': 'count', + 'color': '36/a', +} + + ###################################################################################################################### # # how to graph perdata for OSPF neighbor @@ -39,6 +46,12 @@ graph_info['ospf_neighbor_ospf_events'] = { ], } +graph_info['ospf_neighbor_ospf_retransmission_queue_length'] = { + 'title': _('OSPF neighbor Retransmission queue length'), + 'metrics': [ + ('ospf_neighbor_ospf_retransmission_queue_length', 'area'), + ], +} ###################################################################################################################### # # define perf-o-meter for OSPF neighbor events @@ -48,5 +61,5 @@ graph_info['ospf_neighbor_ospf_events'] = { perfometer_info.append({ 'type': 'linear', 'segments': ['ospf_neighbor_ospf_events'], - 'total': 100, + # 'total': 100, }) diff --git a/web/plugins/wato/ospf_neighbor.py b/web/plugins/wato/ospf_neighbor.py index 16c9b985e478f1db325cd43c982ec6a1f509268e..634ab3a16eab92ff502384676b84f11361e1eddc 100644 --- a/web/plugins/wato/ospf_neighbor.py +++ b/web/plugins/wato/ospf_neighbor.py @@ -18,7 +18,6 @@ from cmk.gui.valuespec import ( Tuple, TextUnicode, MonitoringState, - Transform, ) from cmk.gui.plugins.wato import ( @@ -29,92 +28,91 @@ from cmk.gui.plugins.wato import ( def _parameter_valuespec_ospf_neighbor(): - return Transform( - Dictionary( - elements=[ - ('state_not_found', - MonitoringState( - title=_('State to report if neighbor not found'), - help=_('Monitoring state if the neighbor not found in the SNMP data.'), - default_value=3, - )), - ('neighborstate', - Dictionary( - title=_('State to report for OSPF neighbor state'), + return Dictionary( + elements=[ + ('state_not_found', + MonitoringState( + title=_('State to report if neighbor not found'), + help=_('Monitoring state if the neighbor not found in the SNMP data.'), + default_value=3, + )), + ('neighborstate', + Dictionary( + title=_('State to report for OSPF neighbor state'), + elements=[ + ('1', + MonitoringState( + title=_('1 - down'), + default_value=2, + )), + ('2', + MonitoringState( + title=_('2 - attempt'), + default_value=1, + )), + ('3', + MonitoringState( + title=_('3 - init'), + default_value=1, + )), + ('4', + MonitoringState( + title=_('4 - twoWay'), + default_value=0, + )), + ('5', + MonitoringState( + title=_('5 - exchangeStart'), + default_value=1, + )), + ('6', + MonitoringState( + title=_('6 - exchange'), + default_value=1, + )), + ('7', + MonitoringState( + title=_('7 - loading'), + default_value=1, + )), + ('8', + MonitoringState( + title=_('8 - full'), + default_value=0, + )), + ]) + ), + ('peer_list', + ListOf( + Tuple( + title=('OSPF Neighbors'), elements=[ - ('1', - MonitoringState( - title=_('1 - down'), - default_value=2, - )), - ('2', - MonitoringState( - title=_('2 - attempt'), - default_value=1, - )), - ('3', - MonitoringState( - title=_('3 - init'), - default_value=1, - )), - ('4', - MonitoringState( - title=_('4 - twoWay'), - default_value=0, - )), - ('5', - MonitoringState( - title=_('5 - exchangeStart'), - default_value=1, - )), - ('6', - MonitoringState( - title=_('6 - exchange'), - default_value=1, - )), - ('7', - MonitoringState( - title=_('7 - loading'), - default_value=1, - )), - ('8', - MonitoringState( - title=_('8 - full'), - default_value=0, - )), - ]) - ), - ('peer_list', - ListOf( - Tuple( - title=('OSPF Neighbors'), - elements=[ - TextUnicode( - title=_('OSPF Neighbor IP address'), - help=_( - 'The configured value must match a OSPF Neighbor item reported by the monitored ' - 'device. For example: "10.10.10.10"'), - allow_empty=False, - ), - TextUnicode( - title=_('OSPF Neighbor Alias'), - help=_('You can configure an individual alias here for the OSPF Neighbor matching ' - 'the text configured in the "OSPF Neighbor IP address" field. The alias will ' - 'be shown in the infotext'), - allow_empty=False, - ), - MonitoringState( - default_value=2, - title=_('State if not found'), - help=_('You can configure an individual state if the OSPF Neighbor matching the text ' - 'configured in the "OSPF Neighbor IP address" field is not found') - )]), - add_label=_('Add OSPF Neighbor'), - movable=False, - title=_('OSPF Neighbor specific configuration'), - )), - ], - )) + TextUnicode( + title=_('OSPF Neighbor IP address'), + help=_( + 'The configured value must match a OSPF Neighbor item reported by the monitored ' + 'device. For example: "10.10.10.10"'), + allow_empty=False, + ), + TextUnicode( + title=_('OSPF Neighbor Alias'), + help=_('You can configure an individual alias here for the OSPF Neighbor matching ' + 'the text configured in the "OSPF Neighbor IP address" field. The alias will ' + 'be shown in the infotext'), + allow_empty=False, + ), + MonitoringState( + default_value=2, + title=_('State if not found'), + help=_('You can configure an individual state if the OSPF Neighbor matching the text ' + 'configured in the "OSPF Neighbor IP address" field is not found') + )]), + add_label=_('Add OSPF Neighbor'), + movable=False, + title=_('OSPF Neighbor specific configuration'), + )), + ], + ) rulespec_registry.register(