Page 7 of 12 FirstFirst ... 56789 ... LastLast
Results 61 to 70 of 113

Thread: HowTo: Conky hddtemp

  1. #61
    Join Date
    Mar 2008
    Location
    Paris
    Beans
    72
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HowTo: Conky hddtemp

    thanks
    Flood.fr, the neverending troll (french forum).

  2. #62
    Join Date
    Feb 2007
    Location
    Detroit, Michigan
    Beans
    692

    Re: HowTo: Conky hddtemp

    How To get conky to display hard drive temperature as a non-root user

    Caveat:
    hddtemp requires root privledges [sic] to use.

    Workaround:
    change permissions of the hddtemp command so non-root users can execute it.

    Prerequisites:
    1. conky installed & working apt-get install conky
    2. hddtemp installed apt-get install hddtemp

    The process:
    Once you've got hddtemp installed, go to your terminal prompt and enter the following:
    Code:
    chmod u+s /usr/sbin/hddtemp
    That's it! You're done!

    Now, go to a terminal and type "hddtemp" and your device name at the prompt. For example:
    Code:
    zero@zero-laptop:~$ hddtemp /dev/sda
    /dev/sda: Hitachi HTS541612J9SA00: 42°C
    Or, for the $execi command inside conky, it's as easy as (using myself as the example):
    Code:
    zero@zero-laptop:~$ hddtemp /dev/sda | cut -c36-40
    42°C
    and that will give you a happy little degree symbol in the output and everything, if that's your thing.

    Or, if it's not, you can just use conky's built-in $hddtemp variable now and avoid using the $execi variable altogether, since the conky variable page says of all $exec commands:
    Code:
    warning: this takes a lot more resources than other variables. 
    I'd recommend coding wanted behaviour in C and posting a patch.
    By using this method, not only do you make conky use more resources by calling on netcat, but then you have netcat calling on hddtemp on top of it. Why involve three programs to do the work of one?

    Just my two cents.
    Last edited by detroit/zero; September 24th, 2008 at 01:53 AM.
    I switched to Windows because of all the disappointment Linux brought me.

  3. #63
    Join Date
    Feb 2007
    Location
    Israel
    Beans
    16
    Distro
    Xubuntu 9.10 Karmic Koala

    Re: HowTo: Conky hddtemp

    I looked into the methods of getting the hddtemp in conky as described here, and here are my findings:
    ${hddtemp} has the drawback of returning a value of "35C" for example, whereas i would like to have a "35°C".
    Until this behavior is fixed in conky, it seems that i would have to rely on execi. However, there are several ways to get the reading; i tried to compare them in terms of efficiency by running every command between two date +%N commands, which lets us see the time (in nanoseconds) it takes to execute the command.
    The results are as follows:

    1) hddtemp /dev/hda -n
    Code:
    simon-v@SimonV:~$ date +%N; hddtemp /dev/hda -n; date +%N
    025314728
    37
    208139494
    simon-v@SimonV:~$
    The result is in the range of 0.12-0.18 seconds, not too bad, and can be appended with a "°C" in conky for prettyness.

    2) hddtemp /dev/hda | cut -d: -f3
    Code:
    simon-v@SimonV:~$ date +%N; hddtemp /dev/hda | cut -d:  -f3; date +%N
    362321492
     39°C
    519916187
    simon-v@SimonV:~$
    The result is in the range of 0.12-0.15 seconds, which is not bad too, and gives us the reading ready for display. And it is despite the fact we had to run two programs instead of one.

    3) nc localhost 7634 | cut -d\| -f4
    Code:
    simon-v@SimonV:~$ date +%N ;nc localhost 7634 | cut -d\| -f4; date +%N
    177928746
    40
    224826219
    simon-v@SimonV:~$
    The result is in the range of 0.04-0.14 seconds, which is, surprisingly, the best result of the three, despite there are three programs involved. It too gives the raw reading, which is good.

    I have little idea why it is quicker to netcat hddtemp than to call hddtemp (it makes some sense i must admit), but i think i'll just stick to the third option for now.

    End note: $hddtemp itself seems to be using a call to the hddtemp daemon. Why should we be any different?

  4. #64
    Join Date
    Sep 2008
    Beans
    60

    Re: HowTo: Conky hddtemp

    Code:
    anhvu2875@ubuntu:~$ nc localhost 7634
    |/dev/sg1|ST3160215AS|46|C||/dev/sg2|ST3250310AS|43|C||/dev/sda|ST3160215AS|46|C||/dev/sdb|ST3250310AS|43|C|anhvu2875@ubuntu:~$
    my conky still does not show harddisk temp , any ideas ??
    THANKS !

  5. #65
    Join Date
    Nov 2008
    Beans
    17

    Re: HowTo: Conky hddtemp

    I have 8 disks: /dev/sda to /dev/sdh

    my conkyrc ended up including it like this:

    Code:
    temp: ${execi 30 nc localhost 7634 | awk -F"|" '{print "sda:",$4"C sdb:",$9 "C sdc:",$14"C sdd:",$19"C               sde:",$24"C sdf:",$29"C sdg:",$34"C sdh:",$39"C"}' | fold -w44}
    awk keeps me from having to run 8 different nc commands that each have to query the server..

    mine's set for a width of 50.. if you don't care about width, you can take out that fold and all that whitespace.. or edit out some stuff like the C or the temp: and sd[a-h]:

    ends up looking like:
    Code:
    temp: sda: 35C sdb: 32C sdc: 33C sdd: 34C
          sde: 36C sdf: 36C sdg: 34C sdh: 36C

  6. #66
    Join Date
    Oct 2008
    Beans
    90

    Re: HowTo: Conky hddtemp

    Code:
    :~$ hddtemp /dev/sdb 
    /dev/sdb: ST31000333AS: 28°C
    :~$ hddtemp /dev/sda
    /dev/sda: WDC WD2500KS-00MJB0: 36°C
    This is my readout for my machine. This the code for my conkyrc file.
    Code:
    ${font Arial:bold:size=10}${color White}sda Temp: ${exec nc localhost 7634 | cut -f 4 -d "|"}°C
    ${font Arial:bold:size=10}${color White}/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
    ${fs_bar /home}
    ${font Arial:bold:size=10}${color White}sdb Temp: 
    /disk $alignc ${fs_used /dev/sdb1} / ${fs_size /dev/sdb1} $alignr ${fs_free_perc /dev/sdb1}%
    ${fs_bar /dev/sdb1}
    the code for SDA works correctly, even though I don't have any code for SDB nothing I have tried does not work. Would anyone help a noob?

    Rusty

  7. #67
    Join Date
    Nov 2008
    Beans
    17

    Re: HowTo: Conky hddtemp

    instead of pasting the output of hddtemp /dev/sda and hddtemp /dev/sdb,

    1. look at the output of nc localhost 7634
    2. look at the output of nc localhost 7634 | cut -f 4 -d "|"

    then you will understand why what you were doing doesn't work
    i'm guessing you need to use -f 9 for the output of your second hd
    you might also want to put a time increment on your exec

  8. #68
    Join Date
    Sep 2008
    Beans
    60

    Re: HowTo: Conky hddtemp

    problem was solved !

  9. #69
    Join Date
    Oct 2008
    Beans
    90

    Re: HowTo: Conky hddtemp

    First, when i put a time in on the first line of code my temp disappears.

    second, i have tried what you suggested and put in my code -f 9 through about 40 all I get is a blank line in terminal.

    Third, since I am new to linux I have to do a lot of reading in the forum, and I have and haven't been able to find anything that works.

    Rusty

  10. #70
    Join Date
    Nov 2008
    Beans
    17

    Re: HowTo: Conky hddtemp

    What does the command "nc localhost 7634" show?

    It could also be your hddtemp daemon is only set to show the first hard drive.. in which case you'll have to check your config file..

    for example mine shows:
    dime@lanfear:~$ nc localhost 7634
    |/dev/sda|ST3500641NS|31|C||/dev/sdb|ST3500641NS|29|C||/dev/sdc|ST3500641NS|29|C||/dev/sdd|ST3500641NS|31|C||/dev/sde|ST3500641NS|32|C||/dev/sdf|ST3500641NS|32|C||/dev/sdg|WDC WD2500LB-55EDA0|34|C||/dev/sdh|WDC WD2500LB-55EDA0|34|C|

    about the interval, it's not that big a deal, but it could be because you're using the "exec" variable and not the "execi" variable, which supports an interval
    Last edited by ubdime; November 9th, 2008 at 07:09 PM.

Page 7 of 12 FirstFirst ... 56789 ... LastLast

Bookmarks

Posting Permissions

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