6

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

  • 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 '16 at 7:59
  • 2
    The question is very pertinent, as many SBC servers have temperature related issues. – Rui F Ribeiro Mar 15 '16 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 '16 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 '16 at 1:42
8

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.

3

Some hard drives automatically keep a recent temperature history. From man smartctl:

scttemp, scttempsts, scttemphist - [ATA only] prints the disk temperature information provided by the SMART Command Transport (SCT) commands. The option ´scttempsts´ prints current temperature and temperature ranges returned by the SCT Status command, ´scttemphist´ prints temperature limits and the temperature history table returned by the SCT Data Table command, and ´scttemp´ prints both. The temperature values are preserved across power cycles. The logging interval can be configured with the ´-l scttempint,N[,p]´ option, see below. The SCT commands were introduced in ATA8-ACS and were also supported by many ATA-7 disks.

A command like smartctl -data -l scttemphist /dev/sda will give you a temperature history if the drive supports it. For example:

Index    Estimated Time   Temperature Celsius
 103    2017-06-27 11:10    31  ************
 ...    ..( 24 skipped).    ..  ************
   0    2017-06-27 15:20    31  ************
   1    2017-06-27 15:30    30  ***********
 ...    ..(  9 skipped).    ..  ***********
  11    2017-06-27 17:10    30  ***********
  12    2017-06-27 17:20    31  ************
  13    2017-06-27 17:30    30  ***********
 ...    ..( 51 skipped).    ..  ***********
  65    2017-06-28 02:10    30  ***********
  66    2017-06-28 02:20    31  ************
  67    2017-06-28 02:30    32  *************
  68    2017-06-28 02:40    31  ************
  69    2017-06-28 02:50    30  ***********
  70    2017-06-28 03:00    31  ************
  71    2017-06-28 03:10    30  ***********
  72    2017-06-28 03:20    30  ***********
  73    2017-06-28 03:30    31  ************
  74    2017-06-28 03:40    30  ***********
  75    2017-06-28 03:50    31  ************
  76    2017-06-28 04:00    31  ************
  77    2017-06-28 04:10    30  ***********
 ...    ..( 22 skipped).    ..  ***********
 100    2017-06-28 08:00    30  ***********
 101    2017-06-28 08:10    31  ************
 102    2017-06-28 08:20    30  ***********

Other than that though, you will need to configure/install a tool (see Stephen Kitt's answer).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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