Open goc9000 opened 3 months ago
Thank you! I should create a debug build to better understand why hwmon
source produces "a confusing, unusable mess" on your system. That should be the preferred source since it has a far better performance.
Utils.executeCommandAsync
shouldn't redirect the stderr into stdout, I used to have the very same error on my system as yours and I've always been able to use lm-sensors
until hwmon
source has been introduced, the problem must be somewhere else. I'm gonna investigate further into that if I'm able to reproduce it.
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 hwmon
, the issue is complicated. Reading the data technically works, but there are are several problems that would require a more thorough re-engineering for it to be useful:
Astra shows every hwmon entry as a "sensor" but a lot of those aren't really "sensors" but rather Min/Max values, PWM settings, flags etc. Astra just reports them indiscriminately in the same place, and it's really hard to see what's going on. I'm getting 120+ "sensors" coming from one chip, when in fact there are only 8 or 9 useful values or so. lm-sensors
merges the min/max/critical indicators together with the current value, at the very least, and doesn't report flags or such.
As far as I know, there isn't any way in hwmon
to ignore sensors, rename sensors, or rescale the values. All of which can be done in lm-sensors
and can help remove or fix bad data.
Astra shows sensors of all types: temperature, fan speed, voltages, PWM settings, etc. and seems to treat them equally. In practice though, this information is not equally important. Temperatures will often be the most important indicator, then fan speeds. Voltages and PWM settings tend to be used for debugging and should be normally deemphasized. It's a hard problem, but there should be some way for the user to adjust the priority of various categories of sensors, so that they don't get overloaded with hundreds of values on one screen.
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 hwmon
display to a separate issue ( https://github.com/AstraExt/astra-monitor/issues/145 ).
Note that I've upgraded to the 26 EGOv43 version which should include the trailing commas fix but the lm-sensors
source still doesn't work. There must be more to it.
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