EasyManua.ls Logo

Tripp Lite B092-016 - Example Script - Multiple Email Notifications on each Alert; Example Script - Power Cycling on Pattern Match

Tripp Lite B092-016
257 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
203
Chapter 15: Advanced Configuration
15.1.3 Example script - Power cycling on pattern match
IfforexamplewehadanRPC(PDU)connectedtoport1onaConsoleServerandalsohavesometelecommunicationsdevice
connectedtoport2andwhichispoweredbytheRPCoutlet3.Nowassumethetelecomdevicetransmitsacharacterstream
"EMERGENCY"outonitsserialconsoleporteverytimethatitencounterssomespecicerror,andtheonlywaytoxthiserror
is to power cycle the telecom device.
Therststepistosetupapattern-matchalertonport2tocheckforthepattern"EMERGENCY".
Nextweneedtocreateacustomscripttodealwiththisalert:
# cd /
# mkdir /etc/config/scripts (ifthedirectorydoesnotalreadyexist)
# cp /etc/scripts/portmanager-pattern-alert /etc/config/scripts/portmanager-pattern-alert
Note:Makesuretoremovetheifstatement(whichchecksforacustomscript)fromthenewscript,inordertopreventan
infinite loop.
The pmpower utility is used to send power commands to RPC device in order to power cycle our telecom device:
# pmpower -l port01 -o 3 cycle (TheRPCisonserialport1.ThetelecomdeviceispoweredbyRPCoutlet3)
We can now append this command to our custom script. This will guarantee that our telecom device will be power cycled every
timetheconsolereadsthe"EMERGENCY"characterstreamonport2.
15.1.4 Example script - Multiple email notifications on each alert
Ifyoudesiretosendmorethanoneemailwhenanalerttriggers,youhavetocreateareplacementscriptusingthemethod
described above and add the appropriate lines to your new script.
Currently,thereisascript/etc/scripts/alert-email whichgetsrunfromwithinallthealertscripts(e.g.portmanager-user-alert or
environmental-alert).Thealert-emailscriptisresponsibleforsendingtheemail.Thelinewhichinvokestheemailscriptlooks
as follows:
/bin/sh /etc/scripts/alert-email $suffix &
Ifyouwishtosendanotheremailtoasingleaddressorthesameemailtomanyrecipients,editthecustomscript
appropriately.Youcanfollowtheexamplesinanyofthesevenalertscriptslistedabove.Inparticularlet’sconsiderthe
portmanager-user-alertscript.Ifyouneedtosendthesamealertemailtomorethanoneemailaddress,ndthelinesinthe
scriptresponsibleforinvokingthealert-emailscript,thenaddthefollowinglinesbelowtheexistinglines:
export TOADDR="emailaddress@domain.com"
/bin/sh /etc/scripts/alert-email $suffix &
ThesetwolinesassignanewemailaddresstoTOADDRandinvokethealert-emailscriptinthebackground.

Table of Contents