[SOLVED] Systeminfo binding: Incredible CPU load results

Hi all, I’m quite new to the world of raspberry pi and home automation. On my openHABpi (raspi 4B, 4 GB SDRAM, 4 logical cores), I installed the Systeminfo binding and set up the cp#load1 item:

Number Sensor_OpenHabPi_Temperature "openHABpi CPU temperature" <temperature> { channel="systeminfo:computer:openhab:sensors#cpuTemp" }
Number Sensor_OpenHabPi_CpuLoad "openHABpi CPU load" <heating> { channel="systeminfo:computer:openhab:cpu#load1" }

However, “unfortunately”, the Paper UI always shows incredible low loads to me, which are around 0 % – 0.3 %. Is it really possible that my raspi has so little work? To be sure, I said stress -c 4 -t 120s in an SSH console, trying to raise the CPU load up to 100 %. And I could watch the CPU temperature increasing by ~10 Kelvin, but still, the CPU load did not exceed 3 %.

So what is the problem? Do I understand the meaning of cpu#load1 wrong? Are there any errors in the binding? Or is my pi just such a cool guy that it does not even get stressed when running a stress test? Looking forward to enlightenment! :smiley:

The load1, load5, and load15 channels are the load averages (not CPU utilization). There are plenty of posts on the Internet describing the load average, so I won’t try to replicate those descriptions here.

1 Like

Thanks for the clarification, I confused the names. So does the systeminfo binding provide any option to get the CPU utilization or do I have to use the exec binding for this?

It did at one point, but was removed last year (I think due to lack of support in the underlying library).

Oh, that’s a pity. It would be nice to gain this functionality back.

However, so long, I implemented it via Exec binding:

$OPENHAB_CONF/custom_scripts/mpstat_cpu_utilization.sh

mpstat 2 1 | grep Average | awk '$12 ~ /[0-9.]+/ { printf("%s", (100 - $12) / 100) }'

default.items

String Sensor_OpenHabPi_CpuUtilizationRaw "openHABpi CPU utilization" { channel="exec:command:mpstat_cpu_utilization:output" }
Number Sensor_OpenHabPi_CpuUtilization

default.things

Thing exec:command:mpstat_cpu_utilization "CPU utilization" [
	command="/bin/bash /etc/openhab2/custom_scripts/mpstat_cpu_utilization.sh",
	interval=30,
	timeout=5]

default.rules

rule "Sensor_OpenHabPi_CpuUtilization"
when
	Item Sensor_OpenHabPi_CpuUtilizationRaw changed
then
	Sensor_OpenHabPi_CpuUtilization.postUpdate((Double.parseDouble(Sensor_OpenHabPi_CpuUtilizationRaw.state.toString) * 100) as Number)
end
5 Likes

I gave this a try with OH3.
Checking the results in PaperUI:

  • I see the items (not linked)
  • I don’t see the rule
  • And of course it doesn’t work.

The script works - and the only thing I changed was the path in exec (from /etc/openhab2 to /etc/openhab)

Am I missing something?

I found that I was missing the exec binding. After installing it the things became a bit better.

  • The thing is there
  • The rule is there
  • But the items stil show “NULL”

I can change the thing to “Autorun” (no idea what it means), but it doesn’t change anything.

Sorry for the confusion - I finally got it working.
The whitelist was the last problem I had.

Now it works as expected - thank you.

Hello Mark,
Do you or anyone know whether CPU temperature and Fan speed have been removed from this binding also? I’m on a Mac and whilst on OH2 the binding was able to see and monitor these parameters. Unfortunately under OH3 I notice the channels for these parameters are no longer listed. CPU temperatures & fan speed were very useful as a barometer for any rogue processes running amok on my Mac. Does anyone have any info on this? thanks,

I’m not aware of anything else that was removed from the binding. The availability of information on certain channels on mac depends on what’s supported by the oshi-core library that the binding uses.

Thanks for your reply, but something must have changed seeing as these useful parameters are no longer offered.
I do have a separate background application running called “Mac fans Control” so I can see these parameters in the Mac menu bar. This was also the case in OH2 so it can’t be any newly introduced conflict. Is it possible to get hold of the older OH2 version of this binding and would it install in OH3 I wonder?
Something weird with it too, it kills the whole z wave controller after it’s installed (everything goes OFFLINE) and I had to quit and relaunch OpenHAB to get the z wave network back.

Hi Mark,
SOLUTION: Solved this hiccup! In fact the CPU Temperature and Fan Speed ARE available BUT one has to click the advanced checkbox to see them listed! I can’t recall if this was the case before but it seems a poor choice to have designed the Binding offerings in this fashion…CPU Temp and Fan speed are no more ‘exotic’ or advanced than all the ‘process’ details already routinely listed. I had almost given up and was about to uninstall the Binding and by chance clicked the advanced box. I would recommend an amendment to this Binding to include the ‘missing’ parameters by default. I don’t know how to convey this request to the developers though. regards,

1 Like