f-zappa / check_mk_adsl_line

Check-MK plugin for monitoring adsl lines
GNU General Public License v3.0
3 stars 4 forks source link

Vigor167 Support #10

Open Commifreak opened 4 months ago

Commifreak commented 4 months ago

I have an Vigor 167 and thought I could simply add the 167 to the matches line, but CMK seems to ignore that live change.

However, maybe you could add support for it?

.1.3.6.1.2.1.1.1.0 => DrayTek Corporation, Router Model: Vigor167, Version: 5.2.4, Build Date/Time: Thu Jan 18 11:23:14 CST 2024

The dsl OID block:

.1.3.6.1.2.1.10.94.1.1.1.1.1.0 2
.1.3.6.1.2.1.10.94.1.1.1.1.2.0 4
.1.3.6.1.2.1.10.94.1.1.1.1.3.0 .0.0
.1.3.6.1.2.1.10.94.1.1.1.1.4.0 VDSL2
.1.3.6.1.2.1.10.94.1.1.1.1.5.0 DEFVAL
.1.3.6.1.2.1.10.94.1.1.2.1.1.0 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
.1.3.6.1.2.1.10.94.1.1.2.1.2.0 b5004244 434db221
.1.3.6.1.2.1.10.94.1.1.2.1.3.0 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
.1.3.6.1.2.1.10.94.1.1.2.1.4.0 11
.1.3.6.1.2.1.10.94.1.1.2.1.5.0 9
.1.3.6.1.2.1.10.94.1.1.2.1.6.0 SHOWTIME
.1.3.6.1.2.1.10.94.1.1.2.1.7.0 0
.1.3.6.1.2.1.10.94.1.1.2.1.8.0 148539392
.1.3.6.1.2.1.10.94.1.1.3.1.1.0 
.1.3.6.1.2.1.10.94.1.1.3.1.2.0 fe004452 41590000
.1.3.6.1.2.1.10.94.1.1.3.1.3.0 5.12.29.0_B_A60901
.1.3.6.1.2.1.10.94.1.1.3.1.4.0 6
.1.3.6.1.2.1.10.94.1.1.3.1.5.0 1
.1.3.6.1.2.1.10.94.1.1.3.1.6.0 SHOWTIME
.1.3.6.1.2.1.10.94.1.1.3.1.7.0 0
.1.3.6.1.2.1.10.94.1.1.3.1.8.0 48723968
.1.3.6.1.2.1.10.94.1.1.4.1.1.0 0
.1.3.6.1.2.1.10.94.1.1.4.1.2.0 116030464
.1.3.6.1.2.1.10.94.1.1.4.1.3.0 0
.1.3.6.1.2.1.10.94.1.1.4.1.4.0 0
.1.3.6.1.2.1.10.94.1.1.5.1.1.0 0
.1.3.6.1.2.1.10.94.1.1.5.1.2.0 47840256
.1.3.6.1.2.1.10.94.1.1.5.1.3.0 0
.1.3.6.1.2.1.10.94.1.1.5.1.4.0 0

I could test something if you want to!

Commifreak commented 4 months ago

Just discovered, that my simple change in the matches created a crash report. Maybe this is somehow interesting?

Exception: TypeError ('item' must be a non empty string or ommited entirely, got '')

Traceback:

  File "/omd/sites/l22/bin/cmk", line 112, in <module>
    exit_status = modes.call(mode_name, mode_args, opts, args)
  File "/omd/sites/l22/lib/python3/cmk/base/modes/__init__.py", line 68, in call
    return handler(*handler_args)
  File "/omd/sites/l22/lib/python3/cmk/base/modes/check_mk.py", line 1848, in mode_discover
    discovery.commandline_discovery(
  File "/omd/sites/l22/lib/python3/cmk/base/agent_based/discovery/commandline.py", line 80, in commandline_discovery
    _commandline_discovery_on_host(
  File "/omd/sites/l22/lib/python3/cmk/base/agent_based/discovery/commandline.py", line 174, in _commandline_discovery_on_host
    service_result = analyse_discovered_services(
  File "/omd/sites/l22/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 43, in analyse_discovered_services
    discovered_services=_discover_services(
  File "/omd/sites/l22/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 151, in _discover_services
    {
  File "/omd/sites/l22/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 151, in <dictcomp>
    {
  File "/omd/sites/l22/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 304, in _discover_plugins_services
    yield from (
  File "/omd/sites/l22/lib/python3/cmk/base/agent_based/discovery/_discovered_services.py", line 304, in <genexpr>
    yield from (
  File "/omd/sites/l22/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 73, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/l22/local/lib/python3/cmk/base/plugins/agent_based/adsl_line.py", line 52, in discover_adsl_line
    yield Service(item=oid_end)  # item name follows oid enumeration
  File "/omd/sites/l22/lib/python3/cmk/base/api/agent_based/checking_classes.py", line 73, in __new__
    item=cls._parse_item(item),
  File "/omd/sites/l22/lib/python3/cmk/base/api/agent_based/checking_classes.py", line 84, in _parse_item
    raise TypeError("'item' must be a non empty string or ommited entirely, got %r" % (item,))

Local variables: {'item': ''}

Commifreak commented 4 months ago

I added a print (section) to line 46 to see what values are in use and I got:

[['', '2', '4', '.0.0', '', 'fe004452 41590000', '5.12.29.0_B_A60901', '6', '1', 'SHOWTIME', '0', '48723968', '116030464', '47840256', ''], ['1', '', '', '', '', '', '', '', '', '', '', '', '', '', '116030464'], ['2', '', '', '', '', '', '', '', '', '', '', '', '', '', '47840256']]

Maybe that helps?

Would be AWESOME if we could add 167 support! :)

Commifreak commented 3 months ago

Could you take a look @f-zappa ?

Commifreak commented 2 months ago

I managed to get further.

Firstly I dont understand how the register.snmp_section decides that I get back 3 sections. However, the main issue is, that OIDEnd return int0 for the interface.

By patching the discover function with yield Service(item=(oid_end or '0')) # item name follows oid enumeration the plugin creates services.

However, the human readable function for the speeds seem to expect another unit, because my up and downstreams are not right formatted.

It seems supporting the 167 needs some more adaptations. I dont have any kind of dev environment but if you decide to continue work on this plugin, I would be more than happy to help with testing.

f-zappa commented 2 months ago

Sorry, but I won't put more effort into this plugin. FTTH is coming to our village, we already have the empty tube in our house and are waiting for the actual fibre which should come within the rest of the year. After that, we don't need DSL anymore.

Feel free to fork this repo and continue the development! If you decide to do so, I will link your repo from here.