Hacker News new | past | comments | ask | show | jobs | submit login

Reading a file from sysfs is great and script-friendly, sure. OTOH, finding the right file to read is less straight-forward.

For one, depending on kernel version and compile options, temperature/voltage/rpm files could be found under /sys/class/hwmon, or /sys/devices/virtual, or /sys/devices/platform/soc. And then, say, script found a dozen of those "temp", or "temp∗_input", or "microvolts" files. How to figure out which one is for CPU, motherboard, battery, PSU, air intake? Probably with extra logic, reading corresponding "temp∗_label", if those even exist? Parsing /sys/firmware/devicetree ? Taking hints from parts of the path-name, where such files are found?

lm_sensors is no silver bullet here either, but at least it does passable job discovering/labeling sensors most of the time.




Well, in that case:

  # sensors --help
  Usage: sensors [OPTION]... [CHIP]...
  …
    -j                    Json output




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: