Skip to content

Conversation

Qubad786
Copy link
Contributor

Problem

With newer netdata, we don't have netdata's bindings of lm_sensor anymore which means cpu temperature plugin in master is broken right now.

Solution

We can get the same information from sysfs directly and make sure our netdata plugin reflects the temperature stats accurately.

@Qubad786 Qubad786 requested a review from a team September 26, 2025 11:59
@bugclerk bugclerk changed the title Get cpu temperatures from sysfs NAS-137734 / 26.04 / Get cpu temperatures from sysfs Sep 26, 2025
@bugclerk
Copy link
Contributor

1 similar comment
@bugclerk
Copy link
Contributor

Copy link
Contributor

@yocalebo yocalebo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's either:

  1. copy over lm_sensors python script from netdata
  2. write our own wrapper around lib sensors library

The changes introduced here are extremely less efficient than what we were previously doing. I've sent you a libsensors ctypes wrapper so let's test that and see what we come up with.

@Qubad786 Qubad786 force-pushed the mrehan/fix-cpu-temp-plugin branch from c15081d to 45f8c62 Compare October 2, 2025 12:37
Example: {'coretemp-isa-0000': {'Core 0': 48.0}, 'k10temp-pci-00c3': {'Tctl': 67.0}}
"""
with contextlib.suppress(OSError, RuntimeError):
with SensorsWrapper() as sensors:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using the context manager, it's doing a bunch of CDDL setup functions each time it's called which is painful and unnecessary. We should instantiate a sensors = SensorsWrapper() object once and then just do sensors.get_cpu_temperatures()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants