Re: grep help? - Trying to extra sensors data
From: Genius (genius_at_onthenet.org)
Date: 09/13/04
- Next message: Sikocan: "Re: Anyone Ported Cisco Discovery Protocol? (CDP)"
- Previous message: Paul Lutus: "Re: sorta OT: Knoppix to access linux"
- In reply to: The Hobbit: "grep help? - Trying to extra sensors data"
- Next in thread: The Hobbit: "Re: grep help? - Trying to extra sensors data"
- Reply: The Hobbit: "Re: grep help? - Trying to extra sensors data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 13 Sep 2004 18:04:20 +1200
The Hobbit wrote:
> Hi All,
> I'm trying to extract some data from my sensors output which looks like
> the following:
> --------------------------------------------------
> $ sensors
>
> asb100-i2c-0-2d
> Adapter: SMBus Via Pro adapter at e800
> VCore 1: +1.76 V (min = +1.76 V, max = +1.94 V) ALARM
> +3.3V: +3.34 V (min = +3.14 V, max = +3.47 V)
> +5V: +4.95 V (min = +4.76 V, max = +5.24 V)
> +12V: +12.16 V (min = +10.82 V, max = +13.19 V)
> -12V (reserved):
> -12.70 V (min = -0.00 V, max = -0.00 V)
> -5V (reserved):
> -5.33 V (min = -0.00 V, max = -0.00 V)
> CPU Fan: 5113 RPM (min = 1997 RPM, div = 4)
> Chassis Fan:
> 3125 RPM (min = 3994 RPM, div = 2)
> Power Fan:2860 RPM (min = 3994 RPM, div = 2)
> M/B Temp: +29°C (high = +45°C, hyst = +40°C)
> CPU Temp (Intel):
> +46°C (high = +60°C, hyst = +50°C)
> Power Temp:
> +14°C (high = +45°C, hyst = +40°C)
> CPU Temp (AMD):
> +51°C (high = +60°C, hyst = +50°C)
> vid: +1.850 V
> alarms:
>
> $
> --------------------------------------------------
>
> I can extract things like the VCore by using:
>
> sensors | grep "VCore 1: " | cut -d"+" -f2 | cut -d"V" -f1
>
> and for CPU Fan:
>
> sensors | grep "CPU Fan" | cut -d":" -f2 | cut -d"R" -f1
>
> But, for things such as the Chassis Fan and the CPU Temp where the output
> runs over a couple of lines, I'm not getting any results.
>
> e.g.
> sensors | grep "Power Temp:" | cut -d"+" -f2 | cut -d"Â" -f1
>
> will return "Power Temp:" and not "14" as I'd expect.
>
>
>
> I'm planning to drop this info into RRDTool so any pointers to somewhere
> that I can learn what I'm doing wrong and/or something (please not NRG (at
> this point)) which coulds help me parse this info would be much
> appreciated.
>
>
>
> I'm running FC2 on a ASUSTeK A7V333-RAID (VIA KT333 Chipset) if that helps
> anyone.
>
try preprocessing like this:
sensors | sed '/:$/{N;s/\n//;}' | awk -F: '$1=="Chassis Fan"{print $2}'
when sed sees line ending in : it just reads next line, then substitutes the
embedded newline for nothing. the braces group commands together.
you might find awk more useful than cut for some things because
awk has handy substr function too.
- Next message: Sikocan: "Re: Anyone Ported Cisco Discovery Protocol? (CDP)"
- Previous message: Paul Lutus: "Re: sorta OT: Knoppix to access linux"
- In reply to: The Hobbit: "grep help? - Trying to extra sensors data"
- Next in thread: The Hobbit: "Re: grep help? - Trying to extra sensors data"
- Reply: The Hobbit: "Re: grep help? - Trying to extra sensors data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]