Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Do mainstream Linux distributions typically log system temperature data, e.g. CPU or HDD temperature? If so, where can those logs be found?

share|improve this question
2  
No, unless the distro sees a benefit in doing this per default you'll have to set it up yourself. Ages ago I used rrdtool (as I didn't need long historic data) for this and I'm not surprised it is still being used for this. See a tutorial here: oss.oetiker.ch/rrdtool-trac/wiki/SystemMonitorScripts – Thomas R. Koll Mar 15 at 7:59
1  
The question is very pertinent, as many SBC servers have temperature related issues. – Rui F Ribeiro Mar 15 at 8:57
1  
No they do not; however it is pretty easy with lm_sensors to either put monitoring on a terminal real-time or direct output to a log file. But you will need to set it up - that is easy; you even can set it up for multiple servers with minimum fuss. See wiki.archlinux.org/index.php/… as well as: linuxjournal.com/article/6712 – r0berts Mar 15 at 11:10
    
Thanks for all these comments. Thomas R. Koll and r0berts, feel free to post your helpful comments as answers instead. After all, answers can be upvoted for points! – sampablokuper Mar 16 at 1:42
up vote 6 down vote accepted

I'm not aware of a mainstream Linux distribution which logs this type of information by default. Most mainstream Linux distributions do include various packages which can log temperatures, and some of these packages are set up to log by default.

Taking Debian as an example, sensord will periodically log all the information it knows about (system temperatures, voltages etc.) to the system log, but it needs to be configured manually before it can log anything useful; hddtemp can be set up to periodically log hard drive temperatures. Many other tools can retrieve this type of information (using IPMI, SNMP, etc.) but again in most cases they need to be configured, either to be able to access the information in the first place, or to be able to interpret it, or both.

This configuration requirement means that it would be difficult to set up a generic distribution which logs temperatures by default in a meaningful way. (Most of the systems I've seen have at least one, invalid, monitoring entry which would set off alarms if it was auto-configured!) Of course it's entirely possible to set up an installer image for your own systems since you know what they are and how they're configured... Once you've configured the various tools required to extract temperature information, you'd be better off using a proper monitoring tool (such as Munin) to log the temperatures instead of relying on the system logs. That way you can also set up alerts to be notified when things start going wrong.

Expanding on the sensord example, you can find its output in the system log, with sensord as the process name; so either look for sensord in /var/log/syslog (by default), or run journalctl -u sensord. You'll see periodic logs like the following (I've removed the date and hostname):

sensord[2489]: Chip: acpitz-virtual-0
sensord[2489]: Adapter: Virtual device
sensord[2489]:   temp1: 27.8 C
sensord[2489]:   temp2: 29.8 C
sensord[2489]: Chip: coretemp-isa-0000
sensord[2489]: Adapter: ISA adapter
sensord[2489]:   Physical id 0: 33.0 C
sensord[2489]:   Core 0: 29.0 C
sensord[2489]:   Core 1: 30.0 C
sensord[2489]:   Core 2: 26.0 C
sensord[2489]:   Core 3: 29.0 C
sensord[2489]: Chip: nct6776-isa-0a30
sensord[2489]: Adapter: ISA adapter
sensord[2489]:   in0: +1.80 V (min = +1.60 V, max = +2.00 V)
sensord[2489]:   in1: +1.86 V (min = +1.55 V, max = +2.02 V)
sensord[2489]:   in2: +3.41 V (min = +2.90 V, max = +3.66 V)
sensord[2489]:   in3: +3.39 V (min = +2.83 V, max = +3.66 V)
sensord[2489]:   in4: +1.50 V (min = +1.12 V, max = +1.72 V)
sensord[2489]:   in5: +1.26 V (min = +1.07 V, max = +1.39 V)
sensord[2489]:   in6: +1.04 V (min = +0.80 V, max = +1.20 V)
sensord[2489]:   in7: +3.31 V (min = +2.90 V, max = +3.66 V)
sensord[2489]:   in8: +3.22 V (min = +2.50 V, max = +3.60 V)
sensord[2489]:   fan1: 1251 RPM (min = 200 RPM)
sensord[2489]:   fan2: 0 RPM (min = 0 RPM)
sensord[2489]:   fan3: 299 RPM (min = 200 RPM)
sensord[2489]:   fan4: 1315 RPM (min = 0 RPM)
sensord[2489]:   fan5: 628 RPM (min = 200 RPM)
sensord[2489]:   SYSTIN: 32.0 C (limit = 80.0 C, hysteresis = 70.0 C)
sensord[2489]:   CPUTIN: 33.0 C (limit = 85.0 C, hysteresis = 80.0 C)
sensord[2489]:   AUXTIN: 24.0 C (limit = 80.0 C, hysteresis = 75.0 C)
sensord[2489]:   PECI Agent 0: 31.0 C (limit = 95.0 C, hysteresis = 92.0 C)
sensord[2489]:   PCH_CHIP_CPU_MAX_TEMP: 57.0 C (limit = 95.0 C, hysteresis = 90.0 C)
sensord[2489]:   PCH_CHIP_TEMP: 0.0 C
sensord[2489]:   PCH_CPU_TEMP: 0.0 C
sensord[2489]:   beep_enable: Sound alarm enabled
sensord[2489]: Chip: jc42-i2c-9-18
sensord[2489]: Adapter: SMBus I801 adapter at 0580
sensord[2489]:   temp1: 32.8 C (min = 0.0 C, max = 60.0 C)
sensord[2489]: Chip: jc42-i2c-9-19
sensord[2489]: Adapter: SMBus I801 adapter at 0580
sensord[2489]:   temp1: 33.5 C (min = 0.0 C, max = 60.0 C)
sensord[2489]: Chip: jc42-i2c-9-1a
sensord[2489]: Adapter: SMBus I801 adapter at 0580
sensord[2489]:   temp1: 34.0 C (min = 0.0 C, max = 60.0 C)
sensord[2489]: Chip: jc42-i2c-9-1b
sensord[2489]: Adapter: SMBus I801 adapter at 0580
sensord[2489]:   temp1: 33.2 C (min = 0.0 C, max = 60.0 C)

To get this I had to determine which modules were needed (using sensors-detect): by default the system only knew about the ACPI-reported temperatures, which don't actually correspond to anything (they never vary). coretemp gives the CPU core temperatures on Intel processors, nct6776 is the motherboard's hardware monitor, and jc42 is the temperature monitor on the DIMMs. To make it useful for automated monitoring, I should at least disable the ACPI values and re-label the fans, and correct fan4's minimum value. There are many other configuration possibilities, lm_sensors' example configuration file gives some idea.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.