bashclub / checkmk-opnsense-agent

65 stars 14 forks source link

Error trying to detect gateway when using DHCP IP on WAN interface #4

Closed Jay2k1 closed 1 year ago

Jay2k1 commented 2 years ago

CheckMK says "FailedPythonPlugins: gateway". Running the script with --debug yields

Traceback (most recent call last):
  File "/usr/local/etc/rc.syshook.d/start/99-checkmk_agent", line 164, in do_checks
    _lines += getattr(self,_check)()
  File "/usr/local/etc/rc.syshook.d/start/99-checkmk_agent", line 468, in checklocal_gateway
    _gateway_items = self._config_reader().get("gateways").get("gateway_item",[])
AttributeError: 'NoneType' object has no attribute 'get'

And indeed, the config.xml does not seem to contain any gateway (apart from dns3gw), but there is no <gateway> key. This might be due to the fact that in my setup, the WAN interface has no static IP but DHCP, so the gateway IP is dynamic.

virus2500 commented 2 years ago

Hey, just as a workaround my colleague had the same problem.

He could fix it by

Then the \<gateway> key stays in the config. Again, just as a workaround for the time being.

br

thorstenspille commented 1 year ago

Please check testing branch, should be fixed with https://github.com/bashclub/check-opnsense/commit/e1c5d1a121059f61eaab5db6954f778e59b41693