-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Can't read data via lm-sensors under certain circumstances #133
Comments
Thank you! I should create a debug build to better understand why
The sensors bug with trailing commas is an interesting one, didn't know that. I'm gonna fix that. |
Thanks for working on this. Regarding
|
Having a lot of sensors is currently considered an edge case. In every device I've tested, I've encountered a manageable number of sensors. Nonetheless, I would like to address edge cases as well, but please note that it is not at the top of the priority list right now. If you could provide a screenshot or something to help me understand your specific case, it would be very helpful. |
I've split off the discussion about the Note that I've upgraded to the 26 EGOv43 version which should include the trailing commas fix but the |
Description
On my machine, the
hwmon
source produces a confusing, unusable mess, so I switched to thelm-sensors
source. This worked great with Freon, and it allows one to add overrides in/etc/sensors.d
to edit out badly configured or defective sensors.However, Astra does not display any sensors at all from that source.
I did some digging and I think the problem is that Astra Monitor gets the data by executing
sensors -j
. I think the expectation was that a JSON output is easier to machine-parse than the regular human-readable version.Unfortunately, the JSON output as read by Astra Monitor is not guaranteed to be valid. There are at least two bugs which come into play here:
First, if
sensors
fails to read some values (e.g. sensors are broken, device is turned off etc), it will emit messages on stderr. For instance, on my machine, the output ofsensors -j
begins like this:Note the glaring error message. It is emitted on stderr, but
Utils.executeCommandAsync
redirects stderr to stdout, so the message breaks the JSON structure.Second, and this is a severe bug with
sensors
itself, even if I turn off the offending sensors in/etc/sensors.d
, the output is now:Note the trailing comma, invalid for standard JSON. This is because
sensors
has no real JSON support, it just pastes text lines and doesn't account for all edge cases.It's unlikely that the bug will be fixed in
sensors
anytime soon, but here are some workarounds I recommend:sensors
JSON.parse
to try to get rid of trailing commas, e.g.stdoutString = stdoutString.replace(/,\s*(?=}|])/g, '');
Steps to Reproduce
Ensure that
sensors
produces some output on your machineDisable all sensors under some minor category in lm-sensors by adding e.g.
/etc/sensors.d/temp.conf
with a content like:Run sensors again and note that it should now show a traling comma for that chip/adapter
Switch to
lm-sensors
in the extension and observe how it doesn't detect any sensors at all anymoreEnvironment
Logs
Error seen in logs:
Sensors output with sensor error and stderr redirected to stdout:
sensors_output_with_error.txt
Sensors output with the offending sensor disabled:
sensors_output_with_ignore.txt
Additional Context
N/A
The text was updated successfully, but these errors were encountered: