Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed temperature sensors detection in Linux #905

Closed
wants to merge 1 commit into from

Conversation

tymonx
Copy link

@tymonx tymonx commented Jul 11, 2020

Previous implementation returns all values from the /sys/class/hwmon/hwmon*/temp* location.

It was incorrect and very misleading. The SensorsTemperatures() should return only list of sensors.

Current temperature values are only in the /sys/class/hwmon/hwmon*/temp*_input location.

Reference: https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface

Other files represent thresholds, alarms, setups.

  • Added new optional fields, High (_max) and Critical (_crit)
  • Removed redundant _input suffix. name + label is sufficient
  • Now temperatures, _ := host.SensorsTemperatures(); len(temperatures) returns exacts number of temperature sensors
  • Fixed label strings transformations. Replaced ' ' with '_'. Previous implementation transformed complex labels to
    unreadable and hard to parse strings

Previous implementation returns all values from the /sys/class/hwmon/hwmon*/temp* location.

It was incorrect and very misleading. The SensorsTemperatures() should return only list of sensors.

Current temperature values are only in the /sys/class/hwmon/hwmon*/temp*_input location.

Reference: https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface

Other files represent thresholds, alarms, setups.

* Added new optional fields, High (*_max) and Critical (*_crit)
* Removed redundant _input suffix. name + label is sufficient
* Now temperatures, _ := host.SensorsTemperatures(); len(temperatures) returns exacts number of temperature sensors
* Fixed label strings transformations. Replaced ' ' with '_'. Previous implementation transformed complex labels to
  unreadable and hard to parse strings
@pedrolamas
Copy link

pedrolamas commented Aug 19, 2020

I'm experiencing this same issue on my Armbian based linux, as it contains the "temp*_label" but not the "temp*_input" required for this to work correctly.

image

Looking at the code changes in this PR, I believe they would fix my problem!

@Lomanic
Copy link
Collaborator

Lomanic commented Aug 29, 2020

This makes gopsutil more aligned with psutil and with more sensible results returned, which is always good. Though, it breaks backward compatibility for existing users, hence why I've been reluctant merging this.

Also, this test should be fixed with the new fields.

@pedrolamas
Copy link

It seems Armbian fixed this from their side, as I now have the "temp*_input" after updating to the latest firmware:

image

Telegraf now correctly reports the temperature!

@shirou
Copy link
Owner

shirou commented Oct 16, 2020

I will merge this under v3 directory after v3 released (end of this month, perhaps).

@shirou
Copy link
Owner

shirou commented Nov 1, 2020

Merged by #938. Thank you for your contribution!

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

Successfully merging this pull request may close these issues.

4 participants