-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
joel at carnat.net wrote
(how) can the script be used to fill a RRD database?
Okay, i'm *way* behind you guys here. Where's the best starting point for whipping up info from scratch?
Of note, this is what i wound up with. Yes, wince away at all those pipes. It isn't zippy, but this Rube Goldbergesque script does work.
Caveats: add hobbit to your ipmi users (ipmitool makes this easy), and make sure it can read the /dev/ipmi0, or you're going to feel silly (i made an ipmi group and a udev permission rule to keep the device in it).
Any advice on the shortening the awksed acrobatics below would be appreciated. The problem is that my raw output does NOT include "CPU" or similar.. just "temp." Looking it up, line 1 is the external CPU temp and line 2 is internal... but it comes out like this:
hobbit at currant:~$ ipmitool sensor Temp | 31.000 | degrees C | ok | na | 5.000 | 10.000 | 85.000 | 90.000 | na Temp | 38.000 | degrees C | ok | na | 5.000 | 10.000 | 85.000 | 90.000 | na Planar Temp | 28.000 | degrees C | ok | na | 5.000 | 10.000 | 70.000 | 75.000 | na VRD 0 Temp | 22.000 | degrees C | ok | na | 5.000 | 10.000 | 65.000 | 70.000 | na VRD 1 Temp | 24.000 | degrees C | ok | na | 5.000 | 10.000 | 65.000 | 70.000 | na
"Temp" indeed! You have to "just know" what the first two lines are. This is the start of my using this expensive BMC :), i plan on adding everything Systems wants to see such as fan speed, general case temp, RAID assertions and other joys. For now, getting and graphing CPU core temp is my practice target. here's the script:
#!/bin/sh
umask 133
COLUMN=temp
COLOR=green
MSG="Current Temp"
host=hostname
ipmitool sensor | grep Temp | awk -F\| '{print $1,$2,$3,$4}' > $BBTMP/cputemp.$host
cpu_temp=tail -n 4 $BBTMP/cputemp.$host |head -n 1 | awk '{print $2}' |sed 's/\..*//g'
Converting to Fahrenheit.
temp=$((${cpu_temp}*9/5+32))
Ok, we have the temp in degrees as an integer.
Now to see if it's Very Bad.
if temp > 130 then COLOR=red MSG="${MSG} $temp degrees Fahrenheit!
Hothothot!
"
else MSG="${MSG} $temp Degrees Fahrenheit
Chillin' like a Villain.
"
fi
Get this to the hobbit server
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR date
${MSG} "
exit 0
Rob Munsch Solutions For Progress IT www.solutionsforprogress.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFNmG9BvBcJFK6xYURAoSoAJ9wQS6sFNM5/Q+DFZi27AvzSYTA5gCdGntj gk6ZqNKnmGE2tR8bmS+MpeE= =jO7X -----END PGP SIGNATURE-----