Temperature: Dashboard Temps differ massively from CLI

Started by fastboot, December 01, 2024, 02:15:53 PM

Previous topic - Next topic
Yes, that is why I suggested that way of doing it. First an fgrep does not do regex matching, which is faster and second, by limiting the sysctl output to just a few lines instead of ~15000, the effort is limited.

I thought my comments to the suggested patch made this clear?

However, one could also use a textbox to leave the pattern choice for sysctl to the user with a default of dev.cpu.
Intel N100, 4 x I226-V, 16 GByte, 256 GByte NVME, ZTE F6005

1100 down / 440 up, Bufferbloat A+

To be fair we did not talk dailing back the scope for the widget, because that is the key question here as it also requires chasing the author of the plugin on the subject (which I have now and he agreed that is an option). The fgrep doesn't matter in practice if the sysctl tree is mostly ignored by specifying dev.cpu.


Cheers,
Franco

Actually, before you pointed me to that, I did not realise there were potentially more temp sensors outside of the dev.cpu and hw.acpi sysctl subtrees, nor did I care for any other temperatures...

Wait - does that make me a climate denier? ;-)
Intel N100, 4 x I226-V, 16 GByte, 256 GByte NVME, ZTE F6005

1100 down / 440 up, Bufferbloat A+

I also had no idea that there were other sensors besides CPU that could appear in the widget.  It seems impressions of widget function are guided in part by the type of hardware one has, rather than by widget documentation.

Quote from: franco on December 04, 2024, 11:11:20 AM
# sysctl dev.cpu | grep temperature

So, good people, to inch closer to resolution does this fix your temperature worries?


Cheers,
Franco

Or let's go with

# configctl system sysctl values dev.cpu

for portability's sake.

So? :)

Quote from: Patrick M. Hausen on December 04, 2024, 10:52:30 AM
Quote from: fastboot on December 04, 2024, 10:33:08 AM
Because at the end of the day I want to rely on data. If the data is not correct, I don't need it.

[...]

I really do appreciate the effort of the OPNsense team to create this lovely piece of software. I really do. But also do I appreciate accuracy and data I can rely on.

But the data shown is correct. In the moment the dashboard is rendered the CPU temperature is higher, because of the processing taking place to display the dashboard.

No, the data is not correct. As I logged into a file. There I never reached the 80°C. Also the  CPU is an I3. Guess reading the temperature should now have such an effect on it.

Quote from: fastboot on December 04, 2024, 05:42:43 PM
No, the data is not correct. As I logged into a file. There I never reached the 80°C. Also the  CPU is an I3. Guess reading the temperature should now have such an effect on it.

You logged into a file with the command `sysctl -a | grep temperature`?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: Patrick M. Hausen on December 04, 2024, 05:49:17 PM

You logged into a file with the command `sysctl -a | grep temperature`?

No, not that command. I did not test it, but I would assume that even this would't make a huge difference.


cat test.sh
#!/bin/sh
LOGFILE="/var/log/cpu_temp.log"

while true; do
    TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S.%3N")
    TEMP_DATA=$(sysctl dev.cpu | grep temperature | sort)
    echo "$TIMESTAMP - $TEMP_DATA" >> "$LOGFILE"
    sleep 0.5
done


Not fast enough to reach any evidence that the data is just wrong?
And by the way, even this script stresses the CPU and HDD ;) But not really a tangible or measurable effect. Maybe I am blind?

Like mentioned, my Unix "fu" is limited...

> No, the data is not correct.

I'm not trying to be difficult. It is the reading from the hardware. It is the temperature because the heat sink has had no time to dissipate the heat because it seems to be slower than in the average hardware we see. And if it's not correct, who is faking the temperature? I'm interested to know.  :)


Cheers,
Franco

Like just mentioned. My Unix skills are very limited.

From reading the other threads, the way to measure is "sysctl dev.cpu | grep temperature | sort" but correct me if I am wrong.

As I never reach the 80-82°C with this reading, I assume that the other reading must be wrong. I only reach this specific temperatures when I stress the CPU to 100% and even this does not happen in just 1 second.

[quote author=fastboot link=topic=44373.msg221848#msg221848 date=1733331746]
[quote author=Patrick M. Hausen link=topic=44373.msg221843#msg221843 date=1733330957]

You logged into a file with the command `sysctl -a | grep temperature`?
[/quote]

No, not that command. I did not test it, but I would assume that even this would't make a huge difference.


Trust me, it will. This command reads 16.000 OIDs from the kernel and this is what heats up the CPU.

And while it is perfectly fine to argue that this is not a clever way to read the CPU temperature because a side effect of the reading itself raises it significantly, the temperature read is correct at that very moment.

That's the entire point. Finding better ways to read temperatures while not missing sensors some users might consider essential.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: Patrick M. Hausen on December 04, 2024, 06:09:39 PM
[quote author=fastboot link=topic=44373.msg221848#msg221848 date=1733331746]
[quote author=Patrick M. Hausen link=topic=44373.msg221843#msg221843 date=1733330957]

You logged into a file with the command `sysctl -a | grep temperature`?
[/quote]

No, not that command. I did not test it, but I would assume that even this would't make a huge difference.


Trust me, it will. This command reads 16.000 OIDs from the kernel and this is what heats up the CPU.

And while it is perfectly fine to argue that this is not a clever way to read the CPU temperature because a side effect of the reading itself raises it significantly, the temperature read is correct at that very moment.

That's the entire point. Finding better ways to read temperatures while not missing sensors some users might consider essential.

Well... give the users the choice what they want to see.

When I build dashboards in Grafana, Home Assistant, .... I choose only what I want to see.
But not sure if this is that easy to implement, as I am far away of being a dev myself.

To stress Patrick's point is we are merely arguing for the better half of the year why a decade old code is now showing "wrong" temperatures. If the consensus is to only show the dev.cpu temperature subtree that's fine but eventually **someone** with the issue needs to run the freaking command to confirm... I'm not posting a thirdfourth time about it.


Cheers,
Franco

Unfortunately I do not have any hardware with that modern a CPU and advanced power saving.

On the Netgate device in Frankfurt I get 43 C for each of:
sysctl dev.cpu.0.temperature
sysctl dev.cpu | fgrep dev.cpu.0.temperature
sysctl -a | fgrep dev.cpu.0.temperature
configctl system sysctl values dev.cpu


Similar on the Deciso device here in Karlsruhe - 48.5, 48.6 - rises to 49.0 with the `sysctl -a` method.

We probably need someone with an N100 to actually just run these different commands and post the output.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)