Results 1 to 12 of 12

Thread: [Howto] Install hddtemp

  1. #1

    Post [Howto] Install hddtemp

    Hddtemp is a small utility that gives you the temperature of your hard drive by reading S.M.A.R.T. informations.

    For compilling:

    Code:
    wget http://download.savannah.nongnu.org/releases/hddtemp/hddtemp-0.3-beta15.tar.bz2
    bunzip2 hddtemp-0.3-beta15.tar.bz2
    tar -xf hddtemp-0.3-beta15.tar
    cd hddtemp-0.3-beta15
    Change in configure first string from /bin/sh to /opt/bin/bash

    Code:
    ./configure --prefix=/opt --build=mips
    make
    sudo cp src/hddtemp /opt/bin/
    wget http://www.guzu.net/linux/hddtemp.db
    sudo cp hddtemp.db /opt/etc/
    sudo chmod a+s /opt/bin/hddtemp
    After that you can see the temperature of your HDD via command:
    Code:
     hddtemp -f /opt/etc/hddtemp.db /dev/ide/host2/bus0/target0/lun0/disc
    /dev/ide/host2/bus0/target0/lun0/disc: HDT722516DLAT80: 44?C

    You must install buildroot package for compilling hddtemp.
    Last edited by Denmike; 02-09-2007 at 19:56. Reason: Options for run hddtemp without root rights

  2. #2

    RRDtool for creating graph

    For creating graph of HDD temperature we can use rrdtool (original script is here)

    How to install:

    1. ipkg install rrdtool perl and setup cron like desribed on this forum
    2.
    Code:
    sudo rrdtool create /opt/var/lib/rrd/hddtemp_hda.rrd -s 300 DS:hda:GAUGE:600:0:100 RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
    3. Then create hddtemp.pl and copy it to /opt/etc/cron.5mins
    Code:
    #!/opt/bin/perl
    #
    # Copyright Martin Pot 2003
    # http://martybugs.net/linux/hddtemp.cgi
    
    use RRDs;
    
    # define location of rrdtool binary
    my $rrdtool = '/opt/bin/rrdtool';
    # define location of rrdtool databases
    my $rrd = '/opt/var/lib/rrd';
    # define location of images
    my $img = '/shares/MYVOLUME1/MYSHARE1/images/';
    
    # define image size parameters
    my $size = '-h 80 -w 600';
    
    ## HDD Temperatures #########################
    
    # get hdd temp for master drive on secondary IDE channel
    my $hda=`/opt/bin/hddtemp -f /opt/share/misc/hddtemp.db -n /dev/ide/host2/bus0/target0/lun0/disc`;
    # remove eol chars and white space
    $hda =~ s/[\n ]//g;
    print "hda temp: $hda degrees C\n";
    # insert value into rrd
    `$rrdtool update $rrd/hddtemp_hda.rrd -t hda N:$hda`;
    
    ################################################
    
    # daily hdd temp graph
    RRDs::graph "$img/hddtemp-day.png",
    	"--lazy",
            "-t", "HDD Temperatures",
            "-h", "200", "-w", "600",
            "-a", "PNG",
            "-v", "degrees C",
            "DEF:hda=$rrd/hddtemp_hda.rrd:hda:AVERAGE",
            "LINE2:hda#0000FF:hda 160Gb-Hitachi",
            "GPRINT:hda:MIN:  Min hda\\: %2.lf",
            "GPRINT:hda:LAST: Current hda\\: %2.lf degrees C\\n";
    if ($ERROR = RRDs::error) { print "$0: unable to generate graph: $ERROR\n"; }
    
    # weekly system load graph
    RRDs::graph "$img/hddtemp-week.png",
    	"-s", "-1week", "--lazy",
            "-t", "HDD Temperatures",
            "-h", "200", "-w", "600",
            "-a", "PNG",
            "-v", "degrees C",
            "DEF:hda=$rrd/hddtemp_hda.rrd:hda:AVERAGE",
            "LINE2:hda#0000FF:hda 120Gb-SYS-Seagate",
            "GPRINT:hda:MIN:  Min hda\\: %2.lf",
            "GPRINT:hda:MAX: Max hda\\: %2.lf",
            "GPRINT:hda:LAST: Current hda\\: %2.lf degrees C\\n";
    if ($ERROR = RRDs::error) { print "$0: unable to generate graph: $ERROR\n"; }
    
    # monthly system load graph
    RRDs::graph "$img/hddtemp-month.png",
    	"-s", "-1month", "--lazy",
            "-t", "HDD Temperatures",
            "-h", "200", "-w", "600",
            "-a", "PNG",
            "-v", "degrees C",
            "DEF:hda=$rrd/hddtemp_hda.rrd:hda:AVERAGE",
            "LINE2:hda#0000FF:hda 120Gb-SYS",
            "GPRINT:hda:MIN:  Min hda\\: %2.lf",
            "GPRINT:hda:MAX: Max hda\\: %2.lf",
            "GPRINT:hda:LAST: Current hda\\: %2.lf degrees C\\n";
    if ($ERROR = RRDs::error) { print "$0: unable to generate graph: $ERROR\n"; }
    
    # yearly system load graph
    RRDs::graph "$img/hddtemp-year.png",
    	"-s", "-1year", "--lazy",
            "-t", "HDD Temperatures",
            "-h", "200", "-w", "600",
            "-a", "PNG",
            "-v", "degrees C",
            "DEF:hda=$rrd/hddtemp_hda.rrd:hda:AVERAGE",
            "LINE2:hda#0000FF:hda 120Gb-SYS-Seagate",
            "GPRINT:hda:MIN:  Min hda\\: %2.lf",
            "GPRINT:hda:MAX: Max hda\\: %2.lf",
            "GPRINT:hda:LAST: Current hda\\: %2.lf degrees C\\n";
    if ($ERROR = RRDs::error) { print "$0: unable to generate graph: $ERROR\n"; }
    4. Change path to store images in string to somewhere in your webserver directory for accessing outside:
    Code:
    my $img = '/shares/MYVOLUME1/MYSHARE1/images/';
    5. Now you can see graph of temperature of your disk. Images update every 5 mins with cron.



    Last edited by Denmike; 18-09-2007 at 08:57. Reason: pictures added

  3. #3
    Join Date
    Nov 2007
    Location
    dk
    Posts
    5

    S.M.A.R.T. not available

    When I try, I get this:

    Code:
    [admin@(none) root]$ hddtemp -f /opt/etc/hddtemp.db /dev/discs/disc0/disc
    /dev/discs/disc0/disc: Hitachi HDT725032VLAT80: S.M.A.R.T. not available
    Am I missing anything ?
    Last edited by trider; 14-12-2007 at 00:20. Reason: Wrong code pasted
    If you eat a can of beans, you don't know which one made you fart !

  4. #4
    Join Date
    Feb 2007
    Location
    Moscow, Russia
    Posts
    3,805
    AFAIK not all usb converters let the SMART info to pass through. May be you have bad luck...

  5. #5
    I think, in this case there is no temperature sensor at the disk. But I see it for first time. All modern HDD's have this sensor.

  6. #6
    HDD HITACHI HDT725025VLA380 SATA via ViPower VPA35018, 3'5 SATA USB BOX
    Code:
    [root@asus root]$ smartctl -d scsi /dev/discs/disc0/disc --all
    smartctl version 5.37 [mipsel-unknown-linux-gnu] Copyright (C) 2002-6 Bruce Alle
    n
    Home page is http://smartmontools.sourceforge.net/
    
    Device: Hitachi  HDT725025VLA380  Version:
    Device type: disk
    Local Time is: Thu Mar  6 02:50:27 2008 MSK
    Device supports SMART and is Enabled
    Temperature Warning Disabled or Not Supported
    SMART Health Status: OK
    
    Error Counter logging not supported
    Device does not support Self Test logging
    [root@asus root]$ hddtemp -f /opt/etc/hddtemp.db /dev/discs/disc0/disc
    /dev/discs/disc0/disc: log sense failed : Invalid argument
    smart is working.
    hddtemp writes error.
    strace:
    Code:
    [root@asus root]$ strace hddtemp -f /opt/etc/hddtemp.db /dev/discs/disc0/disc
    execve("/opt/usr/bin/hddtemp", ["hddtemp", "-f", "/opt/etc/hddtemp.db", "/dev/di
    scs/disc0/disc"], [/* 10 vars */]) = 0
    svr4_syscall()                          = -1 ERRNO_4090 (Unknown error 4090)
    stat("/opt/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=9818, ...}) = 0
    open("/opt/etc/ld.so.cache", O_RDONLY)  = 3
    old_mmap(NULL, 9818, PROT_READ, MAP_SHARED, 0, 0) = 0x2ab00000
    close(3)                                = 0
    open("/opt/lib", O_RDONLY)              = 3
    old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 0x
    2aaa9000
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\220\5\0\0004\0\0\0"...
    , 4096) = 3072
    old_mmap(NULL, 69632, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaa000
    old_mmap(0x2aaaa000, 1992, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, -1, 0) =
    0x2aaaa000
    old_mmap(0x2aaba000, 2036, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) =
    0x2aaba000
    close(3)                                = 0
    munmap(0x2aaa9000, 4096)                = 0
    open("/opt/lib/libc.so.0", O_RDONLY)    = 3
    old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 0x
    2aaa9000
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 40
    96) = 4096
    old_mmap(NULL, 741376, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ab03000
    
    old_mmap(0x2ab03000, 645496, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, -1, 0)
    = 0x2ab03000
    old_mmap(0x2abb1000, 4696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) =
    0x2abb1000
    old_mmap(0x2abb3000, 19168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANON
    YMOUS, -1, 0) = 0x2abb3000
    close(3)                                = 0
    munmap(0x2aaa9000, 4096)                = 0
    munmap(0x2ab00000, 9818)                = 0
    ioctl(0, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
    ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
    brk(0)                                  = 0x4179c4
    brk(0x4189c4)                           = 0x4189c4
    brk(0x419000)                           = 0x419000
    open("/dev/discs/disc0/disc", O_RDONLY|O_NONBLOCK) = 3
    ioctl(3, 0x5386, 0x7fff7a88)            = 0
    ioctl(3, 0x2285, {'S', SG_DXFER_FROM_DEV, cmd[6]=[12, 00, 00, 00, 24, 00], mx_sb
    _len=0, iovec_count=0, dxfer_len=36, timeout=3000, flags=0}) = -1 EINVAL (Invali
    d argument)
    ioctl(3, FIBMAP, 0x7fff7220)            = 0
    ioctl(3, 0x30d, 0x417780)               = -1 EINVAL (Invalid argument)
    ioctl(3, 0x5386, 0x7fff7cb0)            = 0
    ioctl(3, FIBMAP, 0x7fff7428)            = 0
    ioctl(3, FIBMAP, 0x7fff6ee8)            = 0
    ioctl(3, FIBMAP, 0x7fff6ee0)            = 0
    ioctl(3, FIBMAP, 0x7fff7000)            = 134217730
    close(3)                                = 0
    write(2, "/dev/discs/disc0/disc", 21/dev/discs/disc0/disc)   = 21
    write(2, ": ", 2: )                       = 2
    write(2, "log sense failed : Invalid argum"..., 35log sense failed : Invalid arg
    ument) = 35
    write(2, "\n", 1
    )                       = 1
    exit(0)                                 = ?
    [root@asus root]$
    Last edited by naves; 06-03-2008 at 00:05.

  7. #7
    HDDTemp is not working via USB. Only pata, sata, scsi and sas interfaces are supported, but only directly.

  8. #8
    I get the following error!

    [root@WL700gE /]$
    [root@WL700gE /]$ wget http://download.savannah.nongnu.org/releases/hddtemp/hd
    emp-0.3-beta15.tar.bz2
    --12:38:08-- http://download.savannah.nongnu.org/...mp/hddtemp-0.3
    eta15.tar.bz2
    => `hddtemp-0.3-beta15.tar.bz2'
    Resolving download.savannah.nongnu.org... failed: Name or service not known.

  9. #9

    re Seagate Free Agent Desktop temperature linux

    Quote Originally Posted by Denmike View Post
    HDDTemp is not working via USB. Only pata, sata, scsi and sas interfaces are supported, but only directly.

    For Seagate Free Agent (using smartctl in linux):
    # smartctl -d sat /dev/sdb --all -T permissive

    for me:
    smartctl -d sat /dev/sdb --all -T permissive | grep 194 | cut -d: -f3 | awk '{print $11}'

    prints the disk temperature

  10. #10

    Check temp periodically and email if too hot...

    Would anyone be interested in a how-to on this? It wasn't complicated, but it's handy for those warm days when my girlfriend forgets to open a window

  11. #11
    I just noticed that the buildrood package is HUGE... I rather not install this, just for compiling this... are there any precompiled packages available?

  12. #12

    Memory leak with digitemp and rrd

    I'm losing 4-8 MB of memory with the attached script using this firmware on a WL-500GP v2. Since I'm running it every two minutes from cron, it eats up my memory in a day and the router either reboots or becomes inaccessible and have to cut the power.

    I'm not an experienced Linux user. Tried ps aux, it doesn't show a change over time. Tried to call digitemp and rrdupdate from command line, no memory leak happens then.

    Could you gurus take a look at my script and point out any suspicious lines or show me more ways to investigate this? TIA.

    Code:
    #!/bin/sh
    log="/opt/var/log/temperature.log"
    err_log="/opt/var/log/digitemp.log"
    home="/opt/var/lib/rrd/digitemp"
    date=`date "+%Y-%m-%d %H:%M:%S"`
    
    t=`/opt/bin/digitemp_DS2490 -q -a -o"%R %4.1C" -c ${home}/.digitemprc`
    
    # Loop, read each valua and add it to the database. Odd values are sensor ID. E$
    i=1
    echo -n "$date" >> $log
    for LINE in $t ; do
       let "odd = $i % 2"
       if [ $odd -eq 1 ]; then
          Sensor=$LINE
       else
          Temperature=$LINE
    
          #  heartbeat on every 60s ( 1min.)
          #    1:1500   -> 1500 sample per every 1min  -> 25h   ( 1 day   + 1 hour )
          #    5:2160   -> 2100 sample per every 5min  -> 180h  ( 1 week  + 0.5 day$
          #    15:3024  -> 3024 sample per every 15min -> 756h  ( 1 month + 0.5 day$
          #    240:2190 -> 2190 sample per every 4h    -> 8760h ( 365 days)
          if [ ! -e ${home}/${Sensor}.rrd ]; then
             echo  "Creating new database for Sensor $Sensor " >> $err_log
             /opt/bin/rrdtool create ${home}/${Sensor}.rrd \
                    --step 60 \
                    DS:temp:GAUGE:300:-40:100 \
                    RRA:AVERAGE:0.5:1:1500 \
                    RRA:AVERAGE:0.5:5:2160 \
                    RRA:AVERAGE:0.5:15:3024 \
                    RRA:AVERAGE:0.5:240:2190
          fi
          echo -n ",${Sensor},${Temperature}" >> $log
          /opt/bin/rrdupdate ${home}/${Sensor}.rrd  N:${Temperature}
       fi
       let i=i+1
    done
    echo "" >> $log
    Run results:
    Code:
    [admin@WL500 digitemp]$ free
                  total         used         free       shared      buffers
      Mem:        30324        27108         3216            0         6032
     Swap:        62712            0        62712
    Total:        93036        27108        65928
    [admin@WL500 digitemp]$ /opt/usr/bin/temp.sh
    [admin@WL500 digitemp]$ free
                  total         used         free       shared      buffers
      Mem:        30324        27112         3212            0         6036
     Swap:        62712            0        62712
    Total:        93036        27112        65924
    [admin@WL500 digitemp]$ /opt/usr/bin/temp.sh
    [admin@WL500 digitemp]$ free
                  total         used         free       shared      buffers
      Mem:        30324        27128         3196            0         6048
     Swap:        62712            0        62712
    Total:        93036        27128        65908
    [admin@WL500 digitemp]$
    Code:
    [admin@WL500 digitemp]$ /opt/bin/procps-ps aux
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    admin        1  0.0  2.1   2384   648 ?        S    Feb25   0:01 /sbin/init
    admin        2  0.0  0.0      0     0 ?        S    Feb25   0:00 [keventd]
    admin        3  0.2  0.0      0     0 ?        RN   Feb25   3:56 [ksoftirqd_CPU]
    admin        4  0.0  0.0      0     0 ?        S    Feb25   0:00 [kswapd]
    admin        5  0.0  0.0      0     0 ?        S    Feb25   0:00 [bdflush]
    admin        6  0.0  0.0      0     0 ?        S    Feb25   0:00 [kupdated]
    admin        7  0.0  0.0      0     0 ?        S    Feb25   0:00 [mtdblockd]
    admin       61  0.0  1.0   2692   332 ?        S    Feb25   0:01 telnetd
    admin       66  0.0  1.5   1944   468 ?        S    Feb25   0:07 httpd vlan1
    admin       67  0.0  1.8   1936   552 ?        Ss   Feb25   0:01 nas /tmp/nas.la
    admin       70  0.0  1.1   2684   360 ?        S    Feb25   0:00 klogd
    nobody      73  0.0  1.6    968   496 ?        S    Feb25   0:01 [dnsmasq]
    admin       74  0.0  1.3   2688   400 ?        S    Feb25   0:00 syslogd -m 0 -O
    admin       75  0.0  0.0      0     0 ?        S    Feb25   0:00 [khubd]
    admin       85  0.0  0.9    956   276 ?        Ss   Feb25   0:00 lpd
    admin       87  0.0  0.8    804   260 ?        Ss   Feb25   0:00 p9100d -f /dev/
    admin       89  0.0  1.1   2376   344 ?        Ss   Feb25   0:00 rcamdmain
    admin       94  0.0  0.0      0     0 ?        S    Feb25   0:02 [usb-storage-0]
    admin       95  0.0  0.0      0     0 ?        S    Feb25   0:00 [scsi_eh_0]
    admin      111  0.0  1.4   2696   432 ?        S    Feb25   0:00 udhcpc -i vlan1
    admin      112  0.0  2.2   2068   684 ?        Ss   Feb25   0:02 pppd file /tmp/
    admin      114  0.0  1.0   1452   312 ?        Ss   Feb25   0:00 infosvr br0
    admin      115  0.0  1.5   2384   468 ?        Ss   Feb25   0:00 watchdog
    admin      118  0.0  1.1   2376   344 ?        Ss   Feb25   0:00 ntp
    admin      135  0.0  0.0      0     0 ?        S    Feb25   0:00 [kjournald]
    admin      146  0.0  1.2    944   384 ?        Ss   Feb25   0:00 /opt/sbin/cron
    admin      157  0.0  4.6   3948  1400 ?        S    Feb25   0:00 /opt/sbin/light
    admin      168  0.0  1.9   2728   584 pts/0    Ss   Feb25   0:00 -sh
    admin    21154  0.0  1.6   1452   512 pts/0    R+   08:05   0:00 /opt/bin/procps
    Last edited by James Bond 007; 26-02-2012 at 06:56.

Similar Threads

  1. [Howto] Install DLNA media servers for Oleg firmware
    By ecaddict in forum WL-500gP Tutorials
    Replies: 18
    Last Post: 06-06-2017, 07:40
  2. Replies: 28
    Last Post: 02-06-2013, 20:58
  3. [HowTo] Install and configure Oleg's firmware
    By wengi in forum WL-500gP Tutorials
    Replies: 957
    Last Post: 22-02-2013, 22:24
  4. HowTo install OpenVPN server
    By Tamadite in forum WL-500g/WL-500gx Tutorials
    Replies: 41
    Last Post: 31-05-2012, 20:41
  5. [Howto] Install kernel modules for Oleg firmware
    By ecaddict in forum WL-500gP Tutorials
    Replies: 0
    Last Post: 05-12-2011, 16:18

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •