Server Temperature Monitor?
Kimball Larsen
kimball at kimballlarsen.com
Mon Feb 2 15:45:07 MST 2009
Thanks for the ugly one-liner. :)
In attempting to understand what it does, I have pulled it apart to
run it a piece at a time. I find the following:
/etc# TEMP=$(sensors -f | grep -m 1 F); echo $TEMP
Core0 Temp: +82.4°F
/etc# TEMP=$(sensors -f | grep -m 1 F); TEMP=$(echo $TEMP | sed 's/
[^[:digit:]]//g'); echo $TEMP;
0824
Looks like it is taking the +82.4°F and making it become 0824, which
is always > 160. So, what is it, exactly, that the magical sed is
doing, and how can I get it to convert the value correctly?
Thanks!
- Kimball
http://www.kimballlarsen.com
On Feb 2, 2009, at 2:17 PM, Joseph Hall wrote:
> On Mon, Feb 2, 2009 at 1:59 PM, Kimball Larsen
> <kimball at kimballlarsen.com> wrote:
>> So, given that I'm not much of a shell scripter guy, anyone have
>> any tips
>> for how to get the system to mail me if the temp ever gets above,
>> say, 160
>> F?
>
> Here's an ugly one-liner for a cron job:
>
> TEMP=$(sensors -f | grep -m 1 F); TEMP=$(echo $TEMP | sed
> 's/[^[:digit:]]//g'); if [ "$TEMP" -ge 160 ]; then echo 'TOO HOT' |
> mail root -s 'TOO HOT'; fi
>
> Of course, you could beautify it and put it into a script too. I'm
> sure plenty of pluggers would be able to give you a much prettier
> script too. This was just a quick and dirty one off the top of my
> head.
>
> --
> Joseph
> http://blog.josephhall.com/
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
More information about the PLUG
mailing list