<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Hi Josh</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Here they are, for what they are worth.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Please note</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>1. These are probably the ugliest scripts I have 
written in years. I acknowledge that, and accept that. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>    They both started as a "Gee! Let's see 
if this works" and grew from there. A horrible way to code.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>2. I make no claims regarding fitness for purpose or 
correctness</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>3. They are to be used at your own risk. (Standard 
disclaimer of liability applies)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>4. They were written to monitor 2 different Models of the 
MGE Galaxy range of UPS - they may work on others. YMMV.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>5. The scripts, particularly the second one, illustrates my 
complete ignorance of SNMP. Please do not judge me on that. 
:-)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>The script runs on the server, and polls the UPS devices, 
so there needs to be a route to the UPS.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>The one talks to the device on port 80, pulling the data 
from the web console.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>The other uses snmp on the appropriate 
ports.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008></SPAN><SPAN 
class=424361502-18092008><FONT face=Arial color=#0000ff size=2>Make sure 
adequate firewall rules are in place.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>The SNMP script uses the ksh string handling tools, which 
are unique to ksh (and possibly bash)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Do not try and run this in sh - it will not 
work.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Have fun.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2> </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Cheers </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>     V</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>In bb-hosts you need an entry like this</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><SPAN 
class=424361502-18092008><FONT face="Courier New" color=#0000ff 
size=2>IP_Address    Host_name    # 
status_web_interface ups UPS_type</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT color=#0000ff 
size=2><FONT face="Courier New">1.2.3.4   
galaxy3000             
# </FONT><A href="http://1.2.3.4/ups_prop.htm"><FONT 
face="Courier New">http://1.2.3.4/ups_prop.htm</FONT></A><FONT 
face="Courier New"> ups galaxy3000 COMMENT:"Level 3 
UPS"</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>The keyword ups is important, because the script scans 
bb-hosts to pull out the ups entries.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>(I said it was ugly)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>There is a UPS_type entry, because I was planning to 
upscale it for more UPS types, but never got mych further than the Galaxy 
range.<BR></DIV></FONT></SPAN>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Changes to hobbitserver.cfg</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face="Courier New" 
color=#0000ff size=2>To TEST2RRD, add "ups=ncv"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face="Courier New" 
color=#0000ff size=2>To GRAPHS, add "ups"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face="Courier New" 
color=#0000ff size=2><FONT face=Arial>Also add following variable</FONT> 
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face="Courier New" 
color=#0000ff size=2>NCV_ups="Load:GAUGE,Charge:GAUGE"<BR></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Add the following to hobbitgraph.cfg</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2><FONT 
face="Courier New">[ups]<BR>        TITLE UPS 
Charge<BR>        YAXIS 
Power<BR>        -u 
100<BR>        -l 
0<BR>        
DEF:u=ups.rrd:Charge:AVERAGE<BR>        
DEF:p=ups.rrd:Load:AVERAGE<BR>        
LINE2:u#00CC00:Charge<BR>        
LINE2:p#0000FF:Load<BR>        
COMMENT:\n<BR>        
GPRINT:u:LAST:Charge   \: %5.1lf%s 
(cur)<BR>        GPRINT:u:MAX: \: %5.1lf%s 
(max)<BR>        GPRINT:u:MIN: \: %5.1lf%s 
(min)<BR>        GPRINT:u:AVERAGE: \: 
%5.1lf%s (avg)\n<BR>        
GPRINT:p:LAST:Load   \: %5.1lf%s 
(cur)<BR>        GPRINT:p:MAX: \: %5.1lf%s 
(max)<BR>        GPRINT:p:MIN: \: %5.1lf%s 
(min)<BR>        GPRINT:p:AVERAGE: \: 
%5.1lf%s (avg)\n</FONT><BR></DIV></FONT></SPAN>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>On the server</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2>Add the following to hobbitlaunch.cfg</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face="Courier New" 
color=#0000ff size=2>[ups]<BR>        ENVFILE 
/usr/lib/hobbit/server/etc/hobbitserver.cfg<BR>        
NEEDS hobbitd<BR>        CMD 
$BBHOME/ext/ups.ksh<BR>        LOGFILE 
$BBSERVERLOGS/ups.log<BR>        INTERVAL 
5m</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=424361502-18092008><FONT face=Arial color=#0000ff size=2>The 
wget script</FONT></SPAN></DIV>
<DIV><SPAN class=424361502-18092008><FONT face="Courier New" color=#0000ff 
size=2>#!/bin/ksh<BR>set 
-x<BR>COLOUR=green<BR>DATE=$(date)<BR>SPACER="                                                                            
"<BR>OUT=$BBTMP/upspage<BR>grep " ups " $BBHOSTS | grep -v "^page" | while read 
IP UPSNAME HASH URL UPS TYPE OTHER<BR>do<BR>   cat 
$UPSNAME<BR>   case $TYPE in<BR>      
galaxy3000)<BR>         
PAGE="$IP/ups_prop.htm"<BR>         wget 
-O $OUT ${PAGE} > 
/dev/null<BR>         echo > 
$OUT.tmp<BR>         cat $OUT | sed -e 
:a -e 's/<[^>]*>//g;/</N;//ba' 
|\<BR>                    
sed 's/^[ \t]*//;s/[ \t]*$//' 
|\<BR>                    
grep -v ^$ | grep -v "()" 
|\<BR>                    
sed -e :a -e '/:$/N; s/:\n/~ /; ta' 
|\<BR>                    
egrep -v "^Help|^About|^Master|^&nbsp" 
|\<BR>                    
sed 's/\&nbsp;/:/g' 
|\<BR>                    
sed -e :a -e '/:$/N; s/:\n/ /; ta' 
|\<BR>                    
sed 's/Last update ~/\nLast update ~/g' 
|\<BR>                    
uniq 
\<BR>                    
>> $OUT.tmp<BR>         #Assign a 
colour</FONT></SPAN></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><SPAN class=424361502-18092008><FONT face="Courier New" color=#0000ff 
size=2>         #FORMAT 
OUTPUT<BR>         grep -v "~"  
$OUT.tmp > $OUT.final<BR>         
echo >> $OUT.final<BR>         
grep "~" $OUT.tmp | while read 
a<BR>         
do<BR>            
LEN=$(echo "$a" | cut -d"~" -f1 | wc 
-c)<BR>            
((FIL=30-LEN))<BR>            
FILLER="${SPACER:1:$FIL}"<BR>            
echo "$a" | sed "s/~/$FILLER/g" >> 
$OUT.final<BR>         
done<BR>         echo '<FONT 
COLOR="Black">' >> 
$OUT.final<BR>         cat $OUT.tmp | 
egrep "Battery charge level|Output load level" 
|\<BR>                        
sed 's/Battery charge level/Charge=/g' 
|\<BR>                        
sed 's/Output load level/Load=/g' 
|\<BR>                        
sed 's/%//g' | sed 's/~//g' 
|\<BR>                        
sed 's/[ \t]*//g' >> 
$OUT.final<BR>         echo 
'</FONT>'  >> $OUT.final<BR>      
;;<BR>   esac<BR>   $BB $BBDISP "status $UPSNAME.ups $COLOUR 
$DATE $(cat $OUT.final)"<BR>   rm $OUT.tmp $OUT.final 
$OUT<BR>done</FONT></SPAN></DIV>
<DIV><SPAN class=424361502-18092008><FONT face="Courier New" color=#0000ff 
size=2><BR>-------------------------------------------------------------------------------------------------------</FONT></SPAN></DIV>
<DIV><SPAN class=424361502-18092008><FONT face=Arial color=#0000ff 
size=2> </DIV></FONT></SPAN>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=424361502-18092008>The 
script using SNMP - rename as appropriate.</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff 
size=2>#!/bin/ksh<BR>DATE=$(date)<BR>#set 
-x<BR>SPACER="                                                                            
"<BR>BBTMP=/tmp<BR>#BBHOSTS=/etc/hobbit/bb-hosts<BR>#OUT=$BBTMP/upspage<BR>grep 
" ups " $BBHOSTS | grep -v "^page" | while read IP UPSNAME HASH URL UPS TYPE 
OTHER<BR>do<BR>   <SPAN class=424361502-18092008># </SPAN>echo 
$IP $UPSNAME</FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT color=#0000ff><FONT size=2><SPAN 
class=424361502-18092008>   #</SPAN><SPAN 
class=424361502-18092008> Do a single ping to make sure there is something 
there.</SPAN><BR>   ping -c1 $IP > /dev/null<SPAN 
class=424361502-18092008> # This might be different in other versions of 
Unix</SPAN><BR>   if [ $? -eq 0 ]<BR>   
then<BR>      
COLOUR=green<BR>      case $TYPE 
in<BR>         
galaxy3000)<BR>            

$OUT.warn<BR>            

$OUT.tmp<BR>            
TEMP=$(snmpget -v1 -c public $IP 
SNMPv2-SMI::mib-2.33.1.1.1.0)<BR>            
DEVICE=${TEMP##*:}       # 
String<BR>            
TEMP=$(snmpget -v1 -c public $IP 
SNMPv2-SMI::mib-2.33.1.1.2.0)<BR>            
MODEL=${TEMP##*:}        # 
String<BR>            
TEMP=$(snmpget -v1 -c public $IP 
SNMPv2-MIB::sysLocation.0)<BR>            
LOCATION=${TEMP##*:}             
# String<BR>            
TEMP=$(snmpget -v1 -c public $IP 
SNMPv2-SMI::mib-2.33.1.1.4.0)<BR>            
SERIAL=${TEMP##*:}               
# String<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.4.8.0)<BR>            
LOWBATTERY=${TEMP##*:}           
# Integer % Point at which shutdown 
triggered<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.5.1.0)<BR>            
TIME_REMAIN=${TEMP##*:}     # Integer 
seconds<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.5.2.0)<BR>            
BATTERY_LEVEL=${TEMP##*:}   # Integer 
%<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.5.9.0)<BR>            
BATTERY_FAULT=${TEMP##*:}   # Integer 1=yes 
2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.5.11.0)<BR>            
BATTERY_REPLACE=${TEMP##*:} # Integer 1=yes 
2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.5.15.0)<BR>            
CHARGER_FAULT=${TEMP##*:}   # Integer 1=yes 
2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.3.0)<BR>            
OUT_ON_BAT=${TEMP##*:}      # Integer 1=yes 
2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.4.0)<BR>            
OUT_ON_BYPASS=${TEMP##*:}   # Integer 1=yes 
2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.10.0)<BR>            
OUT_OVERLOAD=${TEMP##*:}    # Integer 1=yes 
2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.10.0)<BR>            
COMMSOK=${TEMP##*:}         # Integer 
1=yes 2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.6.1.0)<BR>            
INPHASES=${TEMP##*:}        # Integer 1 or 
3</FONT></FONT></FONT></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff 
size=2>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.6.2.1.2)<BR>            
INVOLT=${TEMP##*:}          # 
Integer 10ths of a volt</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff 
size=2>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.6.2.1.3)<BR>            
INFREQ=${TEMP##*:}          # 
Integer 10ths of a Hertz</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff 
size=2>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.6.2.1.6)<BR>            
INAMPS=${TEMP##*:}          # 
Integer 10ths of an Amp</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><FONT 
face="Courier New">            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.6.3.0)<BR>            
INOK=${TEMP##*:}            
# Integer 1=yes 
2=no<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.6.4.0)<BR>            
INFAILCAUSE=${TEMP##*:}     # Integer 1=no 
fault<BR>                                     
#         2=bad 
voltage<BR>                                     
#         3=bad 
frequency<BR>                                     
#         4=no 
voltage<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.1.0)<BR>            
OUTPHASES=${TEMP##*:}       # Integer 1 or 
3<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.2.1.2)<BR>            
OUTVOLT=${TEMP##*:}         # Integer 
10ths of a 
volt<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.2.1.3)<BR>            
OUTFREQ=${TEMP##*:}         # Integer 
10ths of a 
Hertz<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.2.1.4)<BR>            
OUTLOAD=${TEMP##*:}         # Integer 
%<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.2.1.5)<BR>            
OUTAMPS=${TEMP##*:}         # Integer 
10ths of an 
Amp<BR>            
TEMP=$(snmpget -v1 -c public $IP 
1.3.6.1.4.1.705.1.7.11.0)<BR>            
OVERTEMP=${TEMP##*:}        # Integer 1=yes 
2=no<BR>            echo 
"Manufacturer                          
"$DEVICE | sed 's/"//g' >> 
$OUT.tmp<BR>            
echo 
"Model                                
"$MODEL | sed 's/"//g' >> 
$OUT.tmp<BR>            
echo "Serial 
Number                        
"$SERIAL | sed 's/"//g' >> 
$OUT.tmp<BR>            
echo 
"Location                             
"$LOCATION | sed 's/"//g' >> 
$OUT.tmp<BR>            
echo >> 
$OUT.tmp<BR>            
#$LOWBATTERY<BR>            
WARN=""<BR>            [ 
-z "$TIME_REMAIN" ] && 
TIME_REMAIN=0<BR>            
[ $TIME_REMAIN -lt 1200 -a "$COLOUR" != "red" ] && 
COLOUR=yellow<BR>            
[ $TIME_REMAIN -lt 1200 ] && WARN="Time Remaining 
low"<BR>            [ 
$TIME_REMAIN -lt 600 ] && 
COLOUR=red<BR>            
[ $TIME_REMAIN -lt 600 ] && WARN="Time Remaining 
critical"<BR>            
[ "$WARN" != "" ] && echo $WARN >> 
$OUT.warn<BR>            
((s=$TIME_REMAIN%60))<BR>            
((m=$TIME_REMAIN/60))<BR>            
echo "Time 
Remaining                        
"$m Minutes $s Seconds >> 
$OUT.tmp<BR>            
WARN=""<BR>            [ 
-z "$BATTERY_LEVEL" ] && 
BATTERY_LEVEL=0<BR>            
[ $BATTERY_LEVEL -lt 70 -a "$COLOUR" != "red" ] && 
COLOUR=yellow<BR>            
[ $BATTERY_LEVEL -lt 70 ] && WARN="Battery level 
low"<BR>            [ 
$BATTERY_LEVEL -lt 50 ] && 
COLOUR=red<BR>            
[ $BATTERY_LEVEL -lt 50 ] && WARN="Battery level 
critical"<BR>            
[ "$WARN" != "" ] && echo $WARN >> 
$OUT.warn<BR>            
echo "Battery 
Level                        
"$BATTERY_LEVEL % >> 
$OUT.tmp<BR>            
BATTERY_LEVEL=$(echo $BATTERY_LEVEL | sed 's/[ 
\t]*//')<BR>            
if [ $BATTERY_FAULT -eq 1 
]<BR>            
then<BR>               
BF=Yes<BR>               
COLOUR=red<BR>               
echo "Battery Fault!" >> 
$OUT.warn<BR>            
else<BR>               
BF=No<BR>            
fi<BR>            echo 
"Battery 
Fault                         
"$BF >> 
$OUT.tmp<BR>            
if [ $BATTERY_REPLACE -eq 1 
]<BR>            
then<BR>               
BR=Yes<BR>               
COLOUR=red<BR>               
echo "Battery replacement required" >> 
$OUT.warn<BR>            
else<BR>               
BR=No<BR>            
fi<BR>            echo 
"Replace 
Battery                       
"$BR >> 
$OUT.tmp<BR>            
if [ $BATTERY_FAULT -eq 1 
]<BR>            
then<BR>               
BR=Yes<BR>               
COLOUR=red<BR>               
echo "Battery replacement required" >> 
$OUT.warn<BR>            
else<BR>               
BR=No<BR>            
fi<BR>            if [ 
$CHARGER_FAULT -eq 1 
]<BR>            
then<BR>               
CF=Yes<BR>               
COLOUR=red<BR>               
echo "Charger Fault" >> 
$OUT.warn<BR>            
else<BR>               
CF=No<BR>            
fi<BR>            echo 
"Charger 
Fault                         
"$CF >> 
$OUT.tmp<BR>            
if [ $OUT_ON_BAT -eq 1 
]<BR>            
then<BR>               
OUT_ON_BAT=Yes<BR>               
COLOUR=red<BR>               
echo "UPS running on battery" >> 
$OUT.warn<BR>            
else<BR>               
OUT_ON_BAT=No<BR>            
fi<BR>            echo 
"On 
Battery                            
"$OUT_ON_BAT >> 
$OUT.tmp<BR>            
if [ $OUT_ON_BYPASS -eq 1 
]<BR>            
then<BR>               
OUT_ON_BYPASS=Yes<BR>               
COLOUR=red<BR>               
echo "UPS on power bypass" >> 
$OUT.warn<BR>            
else<BR>               
OUT_ON_BYPASS=No<BR>            
fi<BR>            echo 
"On 
Bypass                             
"$OUT_ON_BYPASS >> 
$OUT.tmp<BR>            
if [ $OUT_OVERLOAD -eq 1 
]<BR>            
then<BR>               
OUT_OVERLOAD=Yes<BR>               
COLOUR=red<BR>               
echo "UPS output overload" >> 
$OUT.warn<BR>            
else<BR>               
OUT_OVERLOAD=No<BR>            
fi<BR>            echo 
"Battery 
Overload                      
"$OUT_OVERLOAD >> 
$OUT.tmp<BR>            
if [ $OVERTEMP -eq 1 
]<BR>            
then<BR>               
OVERTEMP=Yes<BR>               
COLOUR=red<BR>               
echo "Unit overheating" >> 
$OUT.warn<BR>            
else<BR>               
OVERTEMP=No<BR>            
fi<BR>            echo 
"Unit 
Overheating                      
"$OVERTEMP >> 
$OUT.tmp<BR>            
#if [ $COMMSOK -eq 2 
]<BR>            
#then<BR>            
#   
COMMSOK=No<BR>            
#   
COLOUR=red<BR>            
#   echo "No comms from device" >> 
$OUT.warn<BR>            
#else<BR>            
#   
COMMSOK=Yes<BR>            
#fi<BR>            #echo 
"Comms 
OK                              
"$COMMSOK >> 
$OUT.tmp<BR>            
echo >> 
$OUT.tmp<BR>            
echo "Input 
Phases                         
"$INPHASES >> 
$OUT.tmp<BR>            
INVOLT=$(echo "scale=1 ; $INVOLT/10" | 
bc)<BR>            echo 
"Input 
Voltage                         
"$INVOLT >> 
$OUT.tmp<BR>            
INFREQ=$(echo "scale=1 ; $INFREQ/10" | 
bc)<BR>            echo 
"Input 
Frequency                       
"$INFREQ >> 
$OUT.tmp<BR>            
INAMPS=$(echo "scale=1 ; $INAMPS/10" | 
bc)<BR>            echo 
"Input 
Current                         
"$INAMPS >> 
$OUT.tmp<BR>            
if [ $INOK -eq 1 
]<BR>            
then<BR>               
# A silly case of reverse logic applies 
here<BR>               
INOK=No<BR>               
COLOUR=red<BR>               
echo "Power input outside tollerance" >> 
$OUT.warn<BR>            
else<BR>               
INOK=Yes<BR>            
fi<BR>            echo 
"Input 
OK                              
"$INOK >> 
$OUT.tmp<BR>            [ 
$INFAILCAUSE -eq 1 ] && FAILCAUSE="No 
failures"<BR>            
[ $INFAILCAUSE -eq 2 ] && FAILCAUSE="Voltage out of 
tollearance"<BR>            
[ $INFAILCAUSE -eq 3 ] && FAILCAUSE="Frequency out of 
tollernace"<BR>            
[ $INFAILCAUSE -eq 4 ] && FAILCAUSE="No voltage - power 
fail"<BR>            echo 
"Cause of 
Failure                      
"$FAILCAUSE >> 
$OUT.tmp<BR>            
echo >> 
$OUT.tmp<BR>            
echo "Output 
Phases                        
"$OUTPHASES >> 
$OUT.tmp<BR>            
OUTVOLT=$(echo "scale=1 ; $OUTVOLT/10" | 
bc)<BR>            echo 
"Output 
Voltage                        
"$OUTVOLT >> 
$OUT.tmp<BR>            
OUTFREQ=$(echo "scale=1 ; $OUTFREQ/10" | 
bc)<BR>            echo 
"Output 
Frequency                      
"$OUTFREQ >> 
$OUT.tmp<BR>            
OUTAMPS=$(echo "scale=1 ; $OUTAMPS/10" | 
bc)<BR>            echo 
"Output 
Current                        
"$OUTAMPS >> 
$OUT.tmp<BR>            
OUTLOAD=$(echo $OUTLOAD | sed 's/[ 
\t]*//')<BR>            
echo "Output 
Load                           
"$OUTLOAD % >> 
$OUT.tmp<BR>            
echo >> 
$OUT.final<BR>            
cat $OUT.warn >> 
$OUT.final<BR>            
cat $OUT.tmp >> 
$OUT.final<BR>            
echo '<FONT COLOR="Black">' >> 
$OUT.final<BR>            
echo "Load=$OUTLOAD" >> 
$OUT.final<BR>            
echo "Charge=$BATTERY_LEVEL" >> 
$OUT.final<BR>            
echo '</FONT>' >> 
$OUT.final<BR>            
rm 
$OUT.tmp<BR>            
rm $OUT.warn<BR>       esac<BR>    
else<BR>       echo "Device Unreachable!" >> 
$OUT.final<BR>       
COLOUR=red<BR>    fi<BR>    $BB $BBDISP "status 
$UPSNAME.ups $COLOUR $DATE $(cat $OUT.final)"<BR>    rm 
$OUT.final<BR>done</FONT></FONT></DIV>
<DIV><FONT face="Courier New" color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=424361502-18092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Josh Luthman 
[mailto:josh@imaginenetworksllc.com] <BR><B>Sent:</B> Thursday, 18 September 
2008 7:27 AM<BR><B>To:</B> hobbit@hswn.dk<BR><B>Subject:</B> Re: [hobbit] UPS 
units<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>Thanks in advance for your input.  Much appreciated.  I 
look forward to reading your scripts!<BR><BR>I will not be wanting to shut my 
servers down, but instead switch them over to generators rather then the AC 
power.  The generators we have at each site are not good/smart enough to 
take in AC power and kick on when it drops, unfortunately.<BR><BR clear=all>Josh 
Luthman<BR>Office: 937-552-2340<BR>Direct: 937-552-2343<BR>1100 Wayne 
St<BR>Suite 1337<BR>Troy, OH 45373<BR><BR>Those who don't understand UNIX are 
condemned to reinvent it, poorly.<BR>--- Henry Spencer<BR><BR><BR>
<DIV class=gmail_quote>On Wed, Sep 17, 2008 at 12:13 PM, Bill Arlofski <SPAN 
dir=ltr><<A 
href="mailto:waa-hobbitml@revpol.com">waa-hobbitml@revpol.com</A>></SPAN> 
wrote:<BR>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
  <DIV class=Ih2E3d><BR>Josh Luthman wrote:<BR>> I haven't looked into the 
  mailing list very closely in the past.  From what<BR>> I know, we're 
  still using "Hobbit", right?<BR>><BR>> I'm looking at getting a full 
  suit of new UPS units and I would like to see<BR>> what everyone is using 
  out there.  I would really like to find something<BR>> that works well 
  with Hobbit so I can monitor them as easy as possible.  I<BR>> will 
  need to have Hobbit go red when power is down (batteries discharging)<BR>> 
  is really my main concern here.  More details would be prettier, though 
  =)<BR>><BR>> Thanks in advance!<BR><BR></DIV>Hi Josh...<BR><BR>I have 
  been using NUT (Network Ups Tools - <A href="http://eu1.networkupstools.org/" 
  target=_blank>http://eu1.networkupstools.org/</A> )<BR>to monitor some APC 
  UPSes. NUT is an excellent client/server UPS monitoring<BR>tool that allows 
  you to automate the shutdown of multiple servers using AC<BR>power from one 
  UPS when the battery is getting low. It can monitor many types<BR>of UPSes, 
  and its client-server construction makes it well-suited to be<BR>monitored by 
  other tools like hobbit, for instance.<BR><BR>I have created several hobbit 
  client scripts to pull information from the NUT<BR>server. These scripts are 
  monitoring and graphing the following stats from<BR>(currently) two UPSes at 
  one of my client's sites:<BR><BR>bat-charge %<BR>ups-load 
  %<BR>in-voltage<BR>out-voltage<BR>bat-voltage<BR><BR><BR>I have been planning 
  (for quite some time now) to get these things cleaned up<BR>and get them on 
  the shire so everyone can make use of them. I have been far<BR>too busy 
  though... I have a few projects coming to a close and may have time<BR>in the 
  coming weeks to get these up there.<BR><BR>Let me take a quick look at my 
  scripts in their current state. Perhaps if they<BR>look reasonable enough, and 
  some people are interested, I may just post them<BR>here with minimal 
  instructions before I get a completed package ready for 
  the<BR>shire.<BR><BR>The only pre-requisite to deploying my scripts is that 
  NUT is currently<BR>installed, running properly and monitoring at least one of 
  your UPSes.<BR><BR>Let me know if this is of interest.   I am looking to 
  give back to the hobbit<BR>community and this might be a perfect chance. 
  :)<BR><FONT color=#888888><BR><BR>--<BR>Bill Arlofski<BR>Reverse Polarity, 
  LLC<BR>860-965-5110 Cell<BR><A href="http://www.revpol.com/" 
  target=_blank>http://www.revpol.com/</A><BR>* Stop the NSA from illegally 
  eavesdropping on your personal email *<BR>Learn about PGP and start encrypting 
  your email today<BR><A href="http://gnupg.org" 
  target=_blank>http://gnupg.org</A> or <A href="http://www.pgp.com" 
  target=_blank>http://www.pgp.com</A><BR></FONT>
  <DIV>
  <DIV></DIV>
  <DIV class=Wj3C7c><BR>To unsubscribe from the hobbit list, send an e-mail 
  to<BR><A 
  href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</A><BR><BR><BR></DIV></DIV></BLOCKQUOTE></DIV><BR></DIV><pre>
NOTICE: This email and any attachments are confidential. 
They may contain legally privileged information or 
copyright material. You must not read, copy, use or 
disclose them without authorisation. If you are not an 
intended recipient, please contact us at once by return 
email and then delete both messages and all attachments.
</pre></BODY></HTML>