hddtemp - monitoring disk temperature

Hddtemp is a tool for reading hard disk temperatures (S.M.A.R.T.). Run it as a daemon, check the database, and integrate it with netcat or telnet!

hddtemp

Disk temperature is a fairly important issue, affecting, among other things, disk lifespan.
hddtemp is a program that displays the temperature of a hard disk. It can run in daemon mode (i.e. run in the background, independently of the user).

  • Running the program once

  • hddtemp disk
    where disk is e.g. /dev/hda,/dev/sda
    hddtemp /dev/hda
    /dev/hda: ST380021A: 38 C
    If hddtemp shows us this kind of result, it means it's working; if not, either our hddtemp database is out of date , or our disk doesn't support S.M.A.R.T. and there's no way to read the temperature.
  • Running hddtemp in daemon mode

  • we need to locate the configuration file, which is called hddtemp; we can use the command for this:
  • find /etc/ -name hddtemp
  • we change the following listed entries in it:
  • # hddtemp network daemon switch. If set to true, hddtemp will listen
    # for incoming connections.
    RUN_DAEMON="true"
    # List of devices you want to use with hddtemp. If none specified,
    # hddtemp will probe standard devices.
    DISKS="/dev/hda /dev/sda"
    	
  • we start our program with the startup script (on debian /etc/init.d/hddtemp start)
  • if for some reason our distribution doesn't have this script, we can always run the application with the -d option
  • hddtemp -d /dev/hd[a-z]
    which will run the application in daemon mode, checking the temperature of all available disks,
  • if we want hddtemp to start on computer reboot, just add the command to rc.local
  • echo "hddtemp -d /dev/hd[a-z]" >>/etc/rc.local
  • to read the temperature after the above operations we can use programs like netcat or telnet
  • nc localhost 7634 or telnet localhost 7634
    |/dev/hda|ST380011A|39|C||/dev/hdc|ST3120026A|42|C|
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    |/dev/hda|ST380011A|39|C||/dev/hdc|ST3120026A|42|C|Connection closed by foreign host.