<HTML>
<HEAD>
<TITLE>Variable use in upssched-cmd</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi all<BR>
<BR>
I have most of the NUT system up and running. I’m in the process of writing the script to send email notifications for certain events. This is my upsshed-cmd file so far:<BR>
<BR>
# EC130 Commands<BR>
<BR>
ec130onbatt)<BR>
echo "EC130 UPS has been on Battery for more then 10 seconds" \<BR>
| mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC130 on battery" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
;;<BR>
ec130combad)<BR>
echo "Communications to EC130 UPS have degraded." \<BR>
| mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC130 bad Communications" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
;;<BR>
ec130cbatt)<BR>
echo "Battery in EC130 UPS needs to be replaced" \<BR>
| mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC130 bad battery" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
;;<BR>
ec130lowbatt)<BR>
echo "Battery in EC130 UPS is low" \<BR>
| mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC130 low battery" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
;;<BR>
#EC132 Commands<BR>
<BR>
ec132onbatt)<BR>
echo "EC132 UPS has been on Battery for more then 10 seconds" \<BR>
| mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC132 on battery" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
;;<BR>
ec132combad)<BR>
echo "Communications to EC132 UPS have degraded." \<BR>
| mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC130 bad Communications" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
;;<BR>
ec132cbatt)<BR>
echo "Battery in EC132 UPS needs to be replaced" \<BR>
| mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC132 bad battery" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
;;<BR>
ec132lowbatt)<BR>
echo "Battery in EC132 UPS is low: \<BR>
| Mailx -r "<a href="ups@fit.edu">ups@fit.edu</a>" -s"EC132 low battery" <a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
<BR>
I have somewhere around 12 ups’s that the server watches and would like to thin out this code a little bit. Is there anyway to have UPSMON send a command such as a COMMBAD * and then have upssched-cmd pickup the upsname from the * and use it to send the approriate email.<BR>
<BR>
Example being a communication error happens on ec132 and sends a commbad * to upssched-cmd. I want upsched-cmd to then send the appriate email “UPS EC132 has bad communications” when this happens. I want to do this using variables so that I only have to write the command out once for each event instead of for each event 12 times.<BR>
<BR>
Hopefully that made sense and pardon the length of the email<BR>
<BR>
Thanks <BR>
<BR>
~Tim<BR>
-- <BR>
Timothy Arbeiter<BR>
Lead Lab Support Technician<BR>
Florida Institute of Technology<BR>
<a href="tarbeite@fit.edu">tarbeite@fit.edu</a><BR>
(321)674-8023<BR>
</SPAN></FONT>
</BODY>
</HTML>