APC apcupsd.conf Temperature Error (APC Smart-UPS 1500 RM, trend computation error)

Dear CheckMK Community,

I made a thread about this chain of problems here already, but I accidently marked that as solved.

To recap:
We have an APC Smart UPS and the Check APC apcupsd.conf Temperature crashes.
We have updated to 2.1.0p4 (in the last thread linked above, this is said to be the solution).
Now we get a different error message and the check still crashes.
From what I understand, this means trend computation doesn’t work anymore?

CMK version: Checkmk Enterprise Edition 2.1.0p5
OS version: Ubuntu 20.04 LTS

Error message:

ValueError: Cannot compute trend. Either specify both variables 'unique_name' and 'value_store' or none.

Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

Checkmk version 2.1.0p4
Try license usage history update.
Trying to acquire lock on /omd/sites/mysite/var/check_mk/license_usage/next_run
Got lock on /omd/sites/mysite/var/check_mk/license_usage/next_run
Trying to acquire lock on /omd/sites/mysite/var/check_mk/license_usage/history.json
Got lock on /omd/sites/mysite/var/check_mk/license_usage/history.json
Next run time has not been reached yet. Abort.
Releasing lock on /omd/sites/mysite/var/check_mk/license_usage/history.json
Released lock on /omd/sites/mysite/var/check_mk/license_usage/history.json
Releasing lock on /omd/sites/mysite/var/check_mk/license_usage/next_run
Released lock on /omd/sites/mysite/var/check_mk/license_usage/next_run
+ FETCHING DATA
  Source: SourceType.HOST/FetcherType.TCP
[cpu_tracking] Start [7ff6af182850]
[TCPFetcher] Fetch with cache settings: DefaultAgentFileCache(pve, base_path=/omd/sites/mysite/tmp/check_mk/cache, max_age=MaxAge(checking=0, discovery=120, inventory=120), disabled=False, use_outdated=False, simulation=False)
Not using cache (Too old. Age is 68 sec, allowed is 0 sec)
[TCPFetcher] Execute data source
Connecting via TCP to 172.16.14.30:6556 (5.0s timeout)
Detected transport protocol: TransportProtocol.TLS (b'16')
Reading data from agent via TLS socket
Reading data from agent
Detected transport protocol: TransportProtocol.PLAIN (b'<<')
Write data to cache file /omd/sites/mysite/tmp/check_mk/cache/pve
Trying to acquire lock on /omd/sites/mysite/tmp/check_mk/cache/pve
Got lock on /omd/sites/mysite/tmp/check_mk/cache/pve
Releasing lock on /omd/sites/mysite/tmp/check_mk/cache/pve
Released lock on /omd/sites/mysite/tmp/check_mk/cache/pve
Closing TCP connection to 172.16.14.30:6556
[cpu_tracking] Stop [7ff6af182850 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=2.5399999991059303))]
  Source: SourceType.HOST/FetcherType.PROGRAM
[cpu_tracking] Start [7ff6af17d4f0]
[ProgramFetcher] Fetch with cache settings: DefaultAgentFileCache(pve, base_path=/omd/sites/mysite/tmp/check_mk/data_source_cache/special_proxmox_ve, max_age=MaxAge(checking=0, discovery=120, inventory=120), disabled=False, use_outdated=False, simulation=False)
Not using cache (Too old. Age is 69 sec, allowed is 0 sec)
[ProgramFetcher] Execute data source
Calling: /omd/sites/mysite/share/check_mk/agents/special/agent_proxmox_ve '-u' 'checkmk@pve' '-p' 'crackundlsd' '--port' 8006 '--no-cert-check' '--timeout' 60 'pve'
Write data to cache file /omd/sites/mysite/tmp/check_mk/data_source_cache/special_proxmox_ve/pve
Trying to acquire lock on /omd/sites/mysite/tmp/check_mk/data_source_cache/special_proxmox_ve/pve
Got lock on /omd/sites/mysite/tmp/check_mk/data_source_cache/special_proxmox_ve/pve
Releasing lock on /omd/sites/mysite/tmp/check_mk/data_source_cache/special_proxmox_ve/pve
Released lock on /omd/sites/mysite/tmp/check_mk/data_source_cache/special_proxmox_ve/pve
[cpu_tracking] Stop [7ff6af17d4f0 - Snapshot(process=posix.times_result(user=0.009999999999999787, system=0.009999999999999981, children_user=0.67, children_system=0.11, elapsed=1.1299999989569187))]

[ ... ] removed all the piggyback stuff (hypervisor)

Trying to acquire lock on /omd/sites/mysite/tmp/check_mk/piggyback/testbuntu/pve
Got lock on /omd/sites/mysite/tmp/check_mk/piggyback/testbuntu/pve
Releasing lock on /omd/sites/mysite/tmp/check_mk/piggyback/testbuntu/pve
Released lock on /omd/sites/mysite/tmp/check_mk/piggyback/testbuntu/pve
Received piggyback data for 50 hosts
[cpu_tracking] Start [7ff6af1102b0]
value store: synchronizing
Trying to acquire lock on /omd/sites/mysite/tmp/check_mk/counters/pve
Got lock on /omd/sites/mysite/tmp/check_mk/counters/pve
value store: loading from disk
Releasing lock on /omd/sites/mysite/tmp/check_mk/counters/pve
Released lock on /omd/sites/mysite/tmp/check_mk/counters/pve
APC apcupsd.conf Status UPSNAME: pve, MODEL: Smart-UPS 1500 RM, SERIALNO: AS0638331142, FIRMWARE: 617.3.I USB FW:8.1, UPSMODE: Stand Alone, Output Voltage: 232V, Output Load: 19.50%, Battery Capacity: 100.00%, Time Left: 1 hour 4 minutes
[cpu_tracking] Stop [7ff6af1102b0 - Snapshot(process=posix.times_result(user=0.009999999999999787, system=0.009999999999999953, children_user=0.0, children_system=0.0, elapsed=0.019999999552965164))]
Trying to acquire lock on /omd/sites/mysite/var/check_mk/crashes/base/403483a0-fc4a-11ec-84c9-9d78292c7bf1/crash.info
Got lock on /omd/sites/mysite/var/check_mk/crashes/base/403483a0-fc4a-11ec-84c9-9d78292c7bf1/crash.info
Releasing lock on /omd/sites/mysite/var/check_mk/crashes/base/403483a0-fc4a-11ec-84c9-9d78292c7bf1/crash.info
Released lock on /omd/sites/mysite/var/check_mk/crashes/base/403483a0-fc4a-11ec-84c9-9d78292c7bf1/crash.info
Traceback (most recent call last):
  File "/omd/sites/mysite/bin/cmk", line 98, in <module>
    exit_status = modes.call("--check", None, opts, args)
  File "/omd/sites/mysite/lib/python3/cmk/base/modes/__init__.py", line 69, in call
    return handler(*handler_args)
  File "/omd/sites/mysite/lib/python3/cmk/base/modes/check_mk.py", line 1804, in mode_check
    checking.commandline_checking(
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/decorator.py", line 43, in wrapped_check_func
    status, output_text = _combine_texts(check_func(hostname, *args, **kwargs))
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 121, in commandline_checking
    return _execute_checkmk_checks(
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 174, in _execute_checkmk_checks
    num_success, plugins_missing_data = check_host_services(
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 322, in check_host_services
    success = _execute_check(
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 382, in _execute_check
    submittable = get_aggregated_result(
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 470, in get_aggregated_result
    result = _aggregate_results(
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 578, in _aggregate_results
    perfdata, results = _consume_and_dispatch_result_types(subresults)
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 622, 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 94, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/mysite/local/lib/python3/cmk/base/plugins/agent_based/apcaccess.py", line 163, in check_apcaccess_temp
    yield from temperature.check_temperature(float(itemp[0]),
  File "/omd/sites/mysite/lib/python3/cmk/base/plugins/agent_based/utils/temperature.py", line 302, in check_temperature
    raise ValueError(
ValueError: Cannot compute trend. Either specify both variables 'unique_name' and 'value_store' or none.

Maybe someone can shed some light on this for me, thanks in advanced!

Best regards,
pixelpoint

There where some code changes for the “check_temperature” function in the last patch releases.
I had a similar problem with on of my checks.
Best would be to make an issue on the github page that @r.sander can fix it then.

If you want to fix it for the time being.

current version

        yield from temperature.check_temperature(float(itemp[0]),
                                                 params,
                                                 unique_name='apcaccess_temp.%s' % item,
                                                 dev_unit=itemp[1].lower())

change to

        yield from temperature.check_temperature(float(itemp[0]),
                                                 params,
                                                 unique_name='apcaccess_temp.%s' % item,
                                                 value_store=get_value_store(),
                                                 dev_unit=itemp[1].lower())

also add at the start

from .agent_based_api.v1 import (
    get_value_store,
)

It looks like that all “check_temperature” calls are broken if not explicitly set the “unique_name” and “value_store”.

Hi @andreas-doehler thank you for answering!

I searched through the files via
grep --color -l -R -i 'yield from temperature.check_temperature' ./*

I get 4 occurences:

./lib/check_mk/base/plugins/agent_based/brocade_optical.py
./lib/python3/cmk/base/plugins/agent_based/brocade_optical.py
./local/lib/check_mk/base/plugins/agent_based/apcaccess.py
./local/lib/python3/cmk/base/plugins/agent_based/apcaccess.py

In which of these would I change the function?
I guess lib/checkmk and lib/python3 are the wrong files, but which of the checks under local/lib do I alter?

Another question:
Will this become a problem when updating to a new CheckMK version or will my changes just be overwritten?

Last question:
Where do I make an issue on the github page?
I visited GitHub - tribe29/checkmk: Checkmk - Best-in-class infrastructure & application monitoring but I couldn’t find where to create an issue.
Is this the correct github page?

Thank you for taking the time to help!

Best regards,
pixelpoint

The problem you have is not caused by the CMK system itself, it is a check that was installed later.
You can see this in your error message.

It is a “local” path and this means manually modified or extra installed checks.
Here you see also what file has the problem.

For the github page normally you should find the correct one inside the installed mkp description.

These two are identical - “./local/lib/check_mk/” is only a link to “./local/lib/python3/cmk/”

@andreas-doehler
Thank you very much for your extensive explanation!
I actually forgot that this is an MKP I installed somewhere along the way, thanks for pointing that out.

I have now altered apcaccess.py and get this:

cmk --debug -vvn pve
[...]
APC apcupsd.conf Status UPSNAME: pve, MODEL: Smart-UPS 1500 RM, SERIALNO: XXXXXXXXX, FIRMWARE: 617.3.I USB FW:8.1, UPSMODE: Stand Alone, Output Voltage: 235V, Output Load: 19.50%, Battery Capacity: 100.00%, Time Left: 1 hour 6 minutes
APC apcupsd.conf Temperature Temperature: 30.6°C
[...]

This seems ok, but the CheckMK UI still tells me the check is crashing.

Exception
ValueError (Cannot compute trend. Either specify both variables 'unique_name' and 'value_store' or none.)

Traceback

  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 470, in get_aggregated_result
    result = _aggregate_results(
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 578, in _aggregate_results
    perfdata, results = _consume_and_dispatch_result_types(subresults)
  File "/omd/sites/mysite/lib/python3/cmk/base/agent_based/checking/__init__.py", line 622, 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 94, in filtered_generator
    for element in generator(*args, **kwargs):
  File "/omd/sites/mysite/local/lib/python3/cmk/base/plugins/agent_based/apcaccess.py", line 163, in check_apcaccess_temp
    itemp = section[item]['ITEMP'].split(' ')
  File "/omd/sites/mysite/lib/python3/cmk/base/plugins/agent_based/utils/temperature.py", line 302, in check_temperature
    raise ValueError(

After finding the correct Github page, I found out there is already an issue for CheckMK 2.1.0 support, so I will mark this thread as solved with your answer as solution.

Thank you very much!

Best regards,
pixelpoint

After the change was a “cmk -R” done?

No, I didn’t do that at first, thanks for pointing it out!

After issueing cmk -R pve it works.
Thank you very much!

Best regards,
pixelpoint

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