rpcgrab.sh 817 Bytes
Newer Older
1
#!/bin/sh
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2005-2009 University of Utah and the Flux Group.
5 6 7 8 9 10 11 12
# All rights reserved.
#

#
# Hack script to extract the latest temp/power/current values from the RPC
# power controller logs.  Used to generate data for the cricket grapher.
# Uses the ancient Utah "reverse cat" tac program.
#
13

14 15
tac=/usr/site/bin/tac

16 17
if [ $# -eq 0 ]; then exit 1; fi
host=$1
18
line=`$tac /usr/testbed/log/powermon.log | grep $host: | head -1`
19
temp=`echo "$line" | sed -n -e 's/.*, \([0-9][0-9]*\.*[0-9]*\)F$/\1/p'`
20
temp=${temp:-'0.0'}
21
power=`echo "$line" | sed -n -e 's/.*, \([0-9][0-9]*\.*[0-9]*\)W, .*/\1/p'`
22
power=${power:-'0.0'}
23
current=`echo "$line" | sed -n -e 's/.*: \([0-9][0-9]*\.*[0-9]*\)A, .*/\1/p'`
24 25
current=${current:-'0.0'}

26 27 28 29
echo $temp degrees F
echo $power Watts
echo $current Amps

30
exit 0