Checkmk Mikrotik plugin V2.3.4

Hi,

I have added the Checkmk Mikrotik plugin V2.3.4 to my site and when I run the cli command to check a device everything shows correctly including the power as per below:

<<<check_mk>>>
Version: 2.0.x.x-mikrotik_agent
<<<lnx_thermal:sep(124)>>>
temperature|enabled|x86_pkg_temp|25000|0|passive|0|passive
<<<mikrotik_power>>>
voltage 13.2

But in the gui I get the following error for Power:

check failed - please submit a crash report! (Crash-ID: 64f57d4a-6100-11ee-8984-005056bb3295)

And the crash report shows this:

File “/omd/sites/mysirte/local/lib/python3/cmk/base/plugins/agent_based/mikrotik_power.py”, line 142, in check_mikrotik_power mysummary.append(‘Power: %s W’ % section[‘power-consumption’])

Does anyone have an idea as to why this is happening?

Thank you

Hi Marius,
I can reproduce this error. I can temporarily fix it by editing ~/local/lib/python3/cmk/base/plugins/agent_based/mikrotik_power.py and initializing the variable with a 0.

It seems that both our devices don’t support multiple PSUs and they don’t show the Wattage.

It would be nice if Tom Tretbar could patch it. Unfortunately I can’t find the git repo to come up with a pull request.

Hi Simon,

Can you please guide me as to which variable you initialized to 0. As soon as I make a change to the file it stops working. When I run the cli command to test the plugin it gives me the correct voltage, its just in the gui where it gives an error.

It would be nice if Tom can provide a fix for it.

Thank you

Marius

Something like this:

diff mikrotik_power.py.orig mikrotik_power.py

105a106,109
>     try:
>         watts  = section['power-consumption']
>     except:
>         watts  = 0
142c146
<     mysummary.append('Power: %s W' % section['power-consumption'])
---
>     mysummary.append('Power: %s W' % watts)

But there’s more to do. Somehow the Voltage is not appended to the output, only shown as metric…

@mariusvton Could you please send output of

cmk -d <my mikrotik device> | sed -n '/<<<mikrotik_power/,/<<</p'

Which firmware version is you mikrotik on? BTW, 2.4.0 is under review, but will not fix your problem.

ttr

Which is by design. I want to keep service summary small.

ttr

@ttr When I run the command cmk -d | sed -n ‘/<<<mikrotik_power/,/<<</p’ nothing is returned

As for the firmware the device is a RB2011 router with firmware is RouterOS 6.47.10.

@mariusvton Did you miss the host?

cmk -d HOSTNAME | ...

Otherwise, send me the mikrotik_power section of you host query. This is part of crash report.

@ttr Please see below the output from the crash report:

I used the IP address of the host and just removed it from the post.

Im still new to CheckMK so please bear with me on some of the things.

Try the hostname as you configured in checkmk, not IP.

@ttr Here is what I get when using the hostname:

cmk -d DeviceHostname| sed -n ‘/<<<mikrotik_power/,/<<</p’
sed: -e expression #1, char 1: unknown command: `▒’
Exception ignored in: <_io.TextIOWrapper name=‘’ mode=‘w’ encoding=‘utf-8’>
BrokenPipeError: [Errno 32] Broken pipe

Just removed the hostname in the post but I used the actual one

Now you somehow inserted some special char, probably cut&paste error. However, your screenshot already revealed the problem: my datasource program just reports some voltage, no current or power. I cannot compute power consumption from just voltage, so this metric is some kind of useless. Maybe mikrotik changed someting.
You could do me some favor: log into your device (SSH) and enter following commands:

system
health
print

Please send output

ttr

@ttr I am waiting for one of the guys to send me the output as I am not there at the moment.

I actually want to measure the voltage because we make use of backup power on a lot of the devices and want to be able to set up notifications when the power drops below certain values. When I run the cli test of your plugin it shows the voltage but it doesnt show in the gui.

RB3011:

[admin@rb3011] > system health print
      voltage: 24.1V
  temperature: 32C
[admin@rb3011] >

RB750Gr3:

[admin@rb750gr3] > system health print
      voltage: 24.7V
  temperature: 37C
[admin@rb750gr3] >

I think the output is similar for the majority of Mikrotik devices.

As for the other output:

OMD[$SITE]:~$ cmk -d $HOSTNAME| sed -n '/<<<mikrotik_power/,/<<</p'
<<<mikrotik_power>>>
voltage 24.1
<<<mikrotik_board>>>

OK. So these devices just report voltage, all mine tell much more. I’ll try and implement some voltage checking with lower WARN levels, but this will be past 2.4.0.