DinoTools / monitoring-check_routeros

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

Check interface - doesn't work - Debian 12, Python 3.11.2, RouterOS 6.49.8 #75

Open alexoalexo opened 9 months ago

alexoalexo commented 9 months ago

As my title says, I'm not able to use the check interface command on my system. Here's the error message I get:

`Traceback (most recent call last): File "/usr/lib/nagios/custom-plugins/./check_routeros.py", line 7, in cli() File "/usr/lib/python3/dist-packages/click/core.py", line 1130, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/nagios/custom-plugins/routeros_check/check/interface.py", line 450, in interface check.main(verbose=ctx.obj["verbose"]) File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 121, in main runtime.execute(self, verbose, timeout) File "/usr/lib/python3/dist-packages/nagiosplugin/runtime.py", line 131, in execute self.run(check) File "/usr/lib/python3/dist-packages/nagiosplugin/runtime.py", line 118, in run check() File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 106, in call self._evaluate_resource(resource) File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 73, in _evaluate_resource metrics = resource.probe() ^^^^^^^^^^^^^^^^ File "/usr/lib/nagios/custom-plugins/routeros_check/check/interface.py", line 307, in probe routeros_metrics += self.get_routeros_metric_item(data[name], name_prefix=f"{name} ", cookie=cookie) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/nagios/custom-plugins/routeros_check/resource.py", line 324, in get_routeros_metric_item value = api_result[metric_value_name]


KeyError: 'rx-drop'
`
DaveFH commented 6 months ago

Sane Problem here...

root@icinga:/tmp/DinoTools-monitoring-check_routeros-bfd0d3e# ./check_routeros.py --host 10.200.1.253 --username icinga --password ***** --port 8728 --no-ssl interface

`Traceback (most recent call last): File "/tmp/DinoTools-monitoring-check_routeros-bfd0d3e/./check_routeros.py", line 7, in cli() File "/usr/lib/python3/dist-packages/click/core.py", line 1130, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/DinoTools-monitoring-check_routeros-bfd0d3e/routeros_check/check/interface.py", line 450, in interface check.main(verbose=ctx.obj["verbose"]) File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 121, in main runtime.execute(self, verbose, timeout) File "/usr/lib/python3/dist-packages/nagiosplugin/runtime.py", line 131, in execute self.run(check) File "/usr/lib/python3/dist-packages/nagiosplugin/runtime.py", line 118, in run check() File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 106, in call self._evaluate_resource(resource) File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 73, in _evaluate_resource metrics = resource.probe() ^^^^^^^^^^^^^^^^ File "/tmp/DinoTools-monitoring-check_routeros-bfd0d3e/routeros_check/check/interface.py", line 291, in probe data = self.fetch_data() ^^^^^^^^^^^^^^^^^ File "/tmp/DinoTools-monitoring-check_routeros-bfd0d3e/routeros_check/check/interface.py", line 257, in fetch_data "speed": result["speed"],


KeyError: 'speed'`

Debian 12.5
Python 3.11.2
RouerOS 7.14.2

all nessessary Python Packages installed:
`root@icinga:/tmp/DinoTools-monitoring-check_routeros-bfd0d3e# apt list --installed | grep python3

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libpython3-dev/stable,now 3.11.2-1+b1 amd64 [installed,automatic]
libpython3-stdlib/stable,now 3.11.2-1+b1 amd64 [installed]
libpython3.11-dev/stable,now 3.11.2-6 amd64 [installed,automatic]
libpython3.11-minimal/stable,now 3.11.2-6 amd64 [installed]
libpython3.11-stdlib/stable,now 3.11.2-6 amd64 [installed]
libpython3.11/stable,now 3.11.2-6 amd64 [installed,automatic]
python3-apt/stable,now 2.6.0 amd64 [installed]
python3-blinker/stable,now 1.5-1 all [installed,automatic]
python3-certifi/stable,now 2022.9.24-1 all [installed]
python3-cffi-backend/stable,now 1.15.1-5+b1 amd64 [installed,automatic]
python3-chardet/stable,now 5.1.0+dfsg-2 all [installed]
python3-charset-normalizer/stable,now 3.0.1-2 all [installed]
**python3-click/stable,now 8.1.3-2 all [installed]**
python3-colorama/stable,now 0.4.6-2 all [installed,automatic]
python3-cryptography/stable,now 38.0.4-3 amd64 [installed,automatic]
python3-dbus/stable,now 1.3.2-4+b1 amd64 [installed,automatic]
python3-debconf/stable,now 1.5.82 all [installed]
python3-debian/stable,now 0.1.49 all [installed]
python3-debianbts/stable,now 4.0.1 all [installed]
python3-dev/stable,now 3.11.2-1+b1 amd64 [installed]
python3-distlib/stable,now 0.3.6-1 all [installed,automatic]
python3-distro/stable,now 1.8.0-1 all [installed,automatic]
python3-distutils/stable,now 3.11.2-3 all [installed,automatic]
python3-filelock/stable,now 3.9.0-1 all [installed,automatic]
python3-gi/stable,now 3.42.2-3+b1 amd64 [installed,automatic]
python3-gpg/stable,now 1.18.0-3+b1 amd64 [installed,automatic]
python3-gunicorn/stable,now 20.1.0-6 all [installed,automatic]
python3-httplib2/stable,now 0.20.4-3 all [installed]
python3-idna/stable,now 3.3-1 all [installed]
python3-jwt/stable,now 2.6.0-1 all [installed,automatic]
python3-lazr.restfulclient/stable,now 0.14.5-1 all [installed,automatic]
python3-lazr.uri/stable,now 1.0.6-3 all [installed,automatic]
python3-ldb/stable,stable-security,now 2:2.6.2+samba4.17.12+dfsg-0+deb12u1 amd64 [installed,automatic]
python3-lib2to3/stable,now 3.11.2-3 all [installed,automatic]
**python3-librouteros/stable,now 3.1.0-2 all [installed]**
python3-minimal/stable,now 3.11.2-1+b1 amd64 [installed]
**python3-nagiosplugin/stable,now 1.3.2-3 all [installed]**
python3-oauthlib/stable,now 3.2.2-1 all [installed,automatic]
python3-openssl/stable,now 23.0.0-1 all [installed,automatic]
python3-pip-whl/stable,now 23.0.1+dfsg-1 all [installed,automatic]
python3-pip/stable,now 23.0.1+dfsg-1 all [installed]
python3-pkg-resources/stable,now 66.1.1-1 all [installed]
python3-platformdirs/stable,now 2.6.0-1 all [installed,automatic]
python3-pycurl/stable,now 7.45.2-3 amd64 [installed]
python3-pyparsing/stable,now 3.0.9-1 all [installed]
python3-pysimplesoap/stable,now 1.16.2-5 all [installed]
python3-reportbug/stable,now 12.0.0 all [installed]
python3-requests/stable,now 2.28.1+dfsg-1 all [installed]
python3-samba/stable,stable-security,now 2:4.17.12+dfsg-0+deb12u1 amd64 [installed,automatic]
python3-setuptools-whl/stable,now 66.1.1-1 all [installed,automatic]
python3-setuptools/stable,now 66.1.1-1 all [installed,automatic]
python3-six/stable,now 1.16.0-4 all [installed]
python3-software-properties/stable,now 0.99.30-4 all [installed,automatic]
python3-talloc/stable,now 2.4.0-f2 amd64 [installed,automatic]
python3-tdb/stable,now 1.4.8-2 amd64 [installed,automatic]
python3-urllib3/stable,now 1.26.12-1 all [installed]
python3-virtualenv/stable,now 20.17.1+ds-1 all [installed,automatic]
python3-wadllib/stable,now 1.3.6-4 all [installed,automatic]
python3-wheel-whl/stable,now 0.38.4-2 all [installed,automatic]
python3-wheel/stable,now 0.38.4-2 all [installed,automatic]
python3.11-dev/stable,now 3.11.2-6 amd64 [installed,automatic]
python3.11-minimal/stable,now 3.11.2-6 amd64 [installed]
python3.11/stable,now 3.11.2-6 amd64 [installed]
python3/stable,now 3.11.2-1+b1 amd64 [installed]
uwsgi-plugin-python3/stable,now 2.0.21-5.1 amd64 [installed]
`

system.clock and some other comands ar working as expected:

`root@icinga:/tmp/DinoTools-monitoring-check_routeros-bfd0d3e# ./check_routeros.py --host 10.200.1.253 --username icinga --password **** --port 8728 --no-ssl system.clock
CLOCK OK - Time diff is -7199.22s | 'time-diff'=-7199.223539s`
phibos commented 6 months ago

I expect the speed error exists since version 7.8. MikroTik has dropped the speed value from the output. I thought this will be fixed in one of the next release but today I have tested it with the latest 7.14.2 release and the value is still missing. But the property is provided with auto completion and in the WinBox GUI

> /interface/ethernet/print proplist=name,speed 
Flags: R - RUNNING
Columns: NAME
#   NAME  
0 R ether1
1 R ether2

Without the speed it is not possible to specify the thresholds in percent. It should be possible to set the speed from the command line. '''--value-override speed:10Gbps''' Feel free to have a look at https://dinotools.github.io/monitoring-check_routeros/cli/#check_routeros-interface

phibos commented 4 months ago

Version 0.10.0 has been released. Can you please check if the new version works for you.

phibos commented 4 months ago

I was able to reproduce the rx-drop error with a very old firmware 6.43. I have tested with RouterOS 6.48+ and 7.11+ and it looks like it is working correctly. @alexoalexo can you please check your RouterOS version.

alexoalexo commented 3 weeks ago

Hi, It works with two of my devices, which are running versions 7.14.3 and 6.49.10. Still not working with another one that is running 7.14.3?

`Traceback (most recent call last): File "/usr/lib/nagios/custom-plugins/check_routeros.py", line 7, in cli() File "/usr/lib/python3/dist-packages/click/core.py", line 1130, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/nagios/custom-plugins/routeros_check/check/interface.py", line 483, in interface check.main(verbose=ctx.obj["verbose"]) File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 121, in main runtime.execute(self, verbose, timeout) File "/usr/lib/python3/dist-packages/nagiosplugin/runtime.py", line 131, in execute self.run(check) File "/usr/lib/python3/dist-packages/nagiosplugin/runtime.py", line 118, in run check() File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 106, in call self._evaluate_resource(resource) File "/usr/lib/python3/dist-packages/nagiosplugin/check.py", line 73, in _evaluate_resource metrics = resource.probe() ^^^^^^^^^^^^^^^^ File "/usr/lib/nagios/custom-plugins/routeros_check/check/interface.py", line 323, in probe routeros_metrics += self.get_routeros_metric_item(data[name], name_prefix=f"{name} ", cookie=cookie) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/nagios/custom-plugins/routeros_check/resource.py", line 329, in get_routeros_metric_item value = api_result[metric_value_name]


KeyError: 'rx-drop'
`
katerasrael commented 3 days ago

Same error here - RouterOS 7.8, debian 12