[wplug] Looking for scripting help to parse information

Jonathan S. Billings wbanguna at gmail.com
Fri Mar 14 12:13:18 EST 2008


On Fri, Mar 14, 2008 at 09:19:14AM -0400, Rob Lines wrote:
> Good morning.
> 
> I am trying to get some information from the ipmitool specifically the
> temperature readings for the CPUs and the ambient temperature.  I can run
> the command and it gives me the 3 values on separate lines.  For other
> sensors I can just use grep to find the distinct name of the sensors but
> with temperature they are all similar.  The CPU values are named Temp and
> the ambient temperature is called Ambient Temp.  So while I can run the
> output through grep to find the ambient temperature there isn't anything
> distinct for the two CPU values.  But they always show up in the same order
> so what I would like to do is have a way to grab a specific line and save
> that into a variable.  I am sure there is a simple way to do this I am just
> not sure where to look for it.
> 
> I would prefer to avoid using perl and just stick to shell scripting if
> possible.

You can pull out the individual readings for separate sensor entities
by using ipmitool sdr entity <entity>.<instance>.  

For example, for two CPUs in my system, I can get the sensor data from
CPU 1 with
ipmitool sdr entity 3.2
and CPU 2 with:
ipmitool sdr entity 3.3

You can use that to query the individual CPUs in your script.  That
way, if one of the CPUs goes away (which would be bad), your script
won't break because the number of fields and order of the fields has
changed. 


-- 
Jonathan Billings <wbanguna at gmail.com>


More information about the wplug mailing list