DinoTools / monitoring-check_routeros

Monitoring plugin for MikroTik devices for Icinga/Nagios/...
GNU General Public License v3.0
11 stars 3 forks source link

OSPF neighbor KeyError: 'adjacency' #68

Closed EsterniTY closed 5 months ago

EsterniTY commented 1 year ago

When ospf neighbor in 2-way state there is no adjacency field received from router and I have this trace:

Traceback (most recent call last):                                                                                                                                                                                                            
  File "/home/user/git/monitoring-check_routeros/./check_routeros.py", line 7, in <module>
    cli()                                           
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__      
    return self.main(*args, **kwargs)                                                                                                                                                                                                         
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)                           
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke       
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                                                                                   
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke                                            
    return ctx.invoke(self.callback, **ctx.params)                                                                     
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke                                             
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 21, in new_func                                                                                                                                                             
    return f(get_current_context(), *args, **kwargs)                                                                   
  File "/home/user/git/monitoring-check_routeros/routeros_check/check/routing_ospf_neighbor.py", line 160, in routing_ospf_neighbors                                                                                                        
    check.main(verbose=ctx.obj["verbose"])                                                                             
  File "/home/user/.local/lib/python3.9/site-packages/nagiosplugin/check.py", line 122, in main                                                                                                                                             
    runtime.execute(self, verbose, timeout)
  File "/home/user/.local/lib/python3.9/site-packages/nagiosplugin/runtime.py", line 132, in execute
    self.run(check)
  File "/home/user/.local/lib/python3.9/site-packages/nagiosplugin/runtime.py", line 119, in run
    check()
  File "/home/user/.local/lib/python3.9/site-packages/nagiosplugin/check.py", line 107, in __call__
    self._evaluate_resource(resource)
  File "/home/user/.local/lib/python3.9/site-packages/nagiosplugin/check.py", line 74, in _evaluate_resource
    metrics = resource.probe()
  File "/home/user/git/monitoring-check_routeros/routeros_check/check/routing_ospf_neighbor.py", line 91, in probe
    return self.get_routeros_metric_item(result)
  File "/home/user/git/monitoring-check_routeros/routeros_check/resource.py", line 326, in get_routeros_metric_item
    value = api_result[metric_value_name]
KeyError: 'adjacency'

Here is api_result example:

{'instance': 'default', 'router-id': '<router-id>', 'state': '2-Way', 'state-changes': 5, 'priority': 1, 'ls-retransmits': 0, 'ls-requests': 0, 'db-summaries': 0}
phibos commented 5 months ago

The issue has been fixed and will be in the next release.