[v2] mrpe check failed - please submit a crash report!

Hi,

I’m using the following check on 2.0.0b3 which I think used to work fine on 1.6, although I’m not 100% sure:
/etc/check_mk/mrpe.cfg

Reboot%20required (interval=300) /usr/sbin/needrestart -p

current output:

UNKN - Kernel: 4.9.230-mainline-rev1, Microcode: unknown, Services: 2 (!), Containers: none, Sessions: none|Kernel=U;0;;0;2 Microcode=U;0;;0;1 Services=2;;0;0 Containers=0;;0;0 Sessions=0;0;;0
Services:
- exim4.service
- unattended-upgrades.service

agent output:

<<<mrpe:cached(1610344439,300)>>>
(needrestart) Reboot%20required 3 UNKN - Kernel: 4.9.230-mainline-rev1, Microcode: unknown, Services: 2 (!), Containers: none, Sessions: none|Kernel=U;0;;0;2 Microcode=U;0;;0;1 Services=2;;0;0 Containers=0;;0;0 Sessions=0;0;;0Services:- exim4.service- unattended-upgrades.service
<<<mrpe>>>
()  0

python traceback:

Traceback (most recent call last):
  File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 578, in get_aggregated_result
    result = _aggregate_results(check_function(**kwargs))
  File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 809, in _aggregate_results
    perfdata, results = _consume_and_dispatch_result_types(subresults)
  File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 853, in _consume_and_dispatch_result_types
    for subr in subresults:
  File "/omd/sites/mysite/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 89, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/mysite/lib/python3/cmk/base/api/agent_based/register/check_plugins_legacy.py", line 177, in check_result_generator
    for subresult in subresults:
  File "/omd/sites/mysite/share/check_mk/checks/mrpe", line 122, in check_mrpe
    new_perf = parse_nagios_perfstring(perfvalue)
  File "/omd/sites/mysite/share/check_mk/checks/mrpe", line 85, in parse_nagios_perfstring
    _strip_unit_float(value),
  File "/omd/sites/mysite/share/check_mk/checks/mrpe", line 70, in _strip_unit_float
    return float(string)
ValueError: could not convert string to float: 'U'

For comparison, output from another machine does not result in a crash:

<<<mrpe:cached(1610344842,300)>>>
(needrestart) Reboot%20required 0 OK - Kernel: 4.19.0-13-amd64, Services: none, Containers: none, Sessions: none|Kernel=0;0;;0;2 Services=0;;0;0 Containers=0;;0;0 Sessions=0;0;;0
<<<mrpe>>>
()  0

The error is in the performance data: Kernel=U;0;;0;2 Microcode=U;0;;0;1.

Needrestart seems to have a bug here.

1 Like

I just hacked together some code based on https://github.com/tribe29/checkmk/blob/1.6.0/checks/mrpe and https://github.com/tribe29/checkmk/blob/1.6.0/checks/parse_nagios.include to compare, checkmk 2.0 now uses different code at github.com/tribe29/checkmk/blob/2.0.0/checks/mrpe (can’t post more than 2 links) - in parse_nagios_perfstring which is no longer compatible with the output generated by needrestart.

On the 1.6 parser check_mrpe() returns

[
    3,
    "(needrestart) Reboot%20required 3 UNKN - Kernel: 4.9.230-mainline-rev1, Microcode: unknown, Services: 2 (!), Containers: none, Sessions: none\nServices:\n- exim4.service\n- unattended-upgrades.service",
    [
        ["Kernel", "U", "0", "", "0", "2"],
        ["Microcode", "U", "0", "", "0", "1"],
        ["Services", "2",  "", "0", "0"],
        ["Containers", "0",  "", "0", "0"],
        ["Sessions", "0", "0", "", "0"],
        "needrestart"
    ]
]

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.