# Network UPS Tools - upssched.conf # $Id: upssched.conf 672 2006-06-05 12:08:34Z jhealy $ # # Used to run external tasks when messages are received from a UPS # # Jason Healy (Suffield Academy) # # ============================================================================ # # CMDSCRIPT # # This script gets called to invoke commands for timers that trigger. # It is given a single argument - the in your # AT ... START-TIMER defines. # # *** This must be defined *before* the first AT line. Otherwise the # program will complain and exit without doing anything. # # A shell script with a big case..esac construct should work nicely for this. # An example has been provided to help you get started. # suffield: jhealy: Added our email/paging script CMDSCRIPT /usr/local/bin/upssched-dispatch # ============================================================================ # # PIPEFN # # This sets the file name of the FIFO that will pass communications between # processes to start and stop timers. This should be set to some path where # normal users can't create the file, due to the possibility of symlinking # and other evil. # # Note: if you are running Solaris or similar, the permissions that # upssched sets on this file *are not enough* to keep you safe. If # your OS ignores the permissions on a FIFO, then you MUST put this in # a protected directory! # # Note 2: by default, upsmon will run upssched as whatever user you have # defined with RUN_AS_USER in upsmon.conf. Make sure that user can # create files and write to files in the path you use for PIPEFN and # LOCKFN. # # My recommendation: create a special directory for upssched, make it # owned by your upsmon user, then use it for both. # # This is commented out by default to make you visit this file and think # about how your system works before potentially opening a hole. # # PIPEFN /var/run/upssched/upssched.pipe # suffield: jhealy: changed to Debian-friendly location PIPEFN /var/run/nut/upssched.pipe # ============================================================================ # # LOCKFN # # REQUIRED. This was added after version 1.2.1. # # upssched needs to be able to create this filename in order to avoid # a race condition when two events are dispatched from upsmon at nearly # the same time. This file will only exist briefly. It must not be # created by any other process. # # You should put this in the same directory as PIPEFN. # # LOCKFN /var/run/upssched/upssched.lock # suffield: jhealy: changed to Debian-friendly location LOCKFN /var/run/nut/upssched.lock # ============================================================================ # # AT # # Define a handler for a specific event on UPS . # # can be the special value * to apply this handler to every # possible value of . # # Run the command via your CMDSCRIPT when it happens. # # Note that any AT that matches both the and the # for the current event will be used. # ============================================================================ # # Possible AT commands # # - START-TIMER # # Start a timer called that will trigger after # seconds, calling your CMDSCRIPT with as the first # argument. # # Example: # Start a timer that'll execute when any UPS (*) has been gone 10 seconds # # AT COMMBAD * START-TIMER upsgone 10 # ----------------------------------------------------------------------- # # - CANCEL-TIMER [cmd] # # Cancel a running timer called , if possible. If the timer # has passed then pass the optional argument to CMDSCRIPT. # # Example: # If a specific UPS (myups@localhost) comes back online, then stop the # timer before it triggers # # AT COMMOK myups@localhost CANCEL-TIMER upsgone # ----------------------------------------------------------------------- # # - EXECUTE # # Immediately pass as an argument to CMDSCRIPT. # # Example: # If any UPS (*) reverts to utility power, then execute # 'ups-back-on-line' via CMDSCRIPT. # # AT ONLINE * EXECUTE ups-back-on-line # suffield: jhealy: defined script actions for different possibilities # # Note that each UPS must have its own timers defined; otherwise # events will get merged together under the same timer. ### ### Immediate alerts (no delay; send warning right now) ### # If you want to get notified of every single power blip, enable these lines # instead of all the ONBATT and ONLINE timers in the next section #AT ONBATT * EXECUTE PAGE_ANY_ONBATT #AT ONLINE * EXECUTE PAGE_ANY_ONLINE # suffield: jhealy: I like to get these in e-mail, but not by pager # if the power is off for an extended time, the pager will get the full # notice AT ONBATT * EXECUTE EMAIL_ANY_ONBATT AT ONBATT * EXECUTE SYSLOG_ANY_ONBATT AT ONLINE * EXECUTE EMAIL_ANY_ONLINE AT ONLINE * EXECUTE SYSLOG_ANY_ONLINE # When the battery goes critical AT LOWBATT * EXECUTE PAGE_ANY_LOWBATT AT LOWBATT * EXECUTE EMAIL_ANY_LOWBATT AT LOWBATT * EXECUTE SYSLOG_ANY_LOWBATT # When it comes time to shut down all systems AT FSD barbara@localhost EXECUTE EXEC:fsd_Barbara_FSD AT FSD barbara@localhost EXECUTE PAGE_Barbara_FSD AT FSD barbara@localhost EXECUTE SYSLOG_Barbara_FSD # Dependent systems that can't shut themselves down AT FSD tara@localhost EXECUTE EXEC:shutdownNs1_Tara_FSD AT FSD tara@localhost EXECUTE EXEC:shutdownWiz_Tara_FSD AT FSD tara@localhost EXECUTE EXEC:shutdownWoz_Tara_FSD AT FSD tara@localhost EXECUTE EXEC:shutdownRon_Tara_FSD AT FSD tara@localhost EXECUTE EXEC:shutdownCampusManager_Paris_FSD AT FSD jenna@localhost EXECUTE EXEC:shutdownBigdog_Jenna_FSD AT FSD ally@localhost EXECUTE EXEC:shutdownFm_Ally_FSD # This is for local system shutdown #AT SHUTDOWN * EXECUTE SYSLOG_ANY_SHUTDOWN # Notify the admin of warning conditions AT REPLBATT * EXECUTE EMAIL_ANY_REPLBATT AT REPLBATT * EXECUTE SYSLOG_ANY_REPLBATT AT NOCOMM * EXECUTE PAGE_ANY_NOCOMM AT NOCOMM * EXECUTE EMAIL_ANY_NOCOMM AT NOCOMM * EXECUTE SYSLOG_ANY_NOCOMM ### ### Delayed alerts (wait a few seconds to make sure it's for real) ### # When we go on battery, wait a little to make sure it's not just a brownout # (or a self-test, which lasts about 5 seconds), so we set a short timer that # must expire first. We cancel the timer below if the power comes back on. AT ONBATT barbara@localhost START-TIMER PAGE_Barbara_ONBATT 15 AT ONBATT paris@localhost START-TIMER PAGE_Paris_ONBATT 15 AT ONBATT tara@localhost START-TIMER PAGE_Tara_ONBATT 15 AT ONBATT ashlee@localhost START-TIMER PAGE_Ashlee_ONBATT 15 AT ONBATT jamie@localhost START-TIMER PAGE_Jamie_ONBATT 15 AT ONBATT ally@localhost START-TIMER PAGE_Ally_ONBATT 15 AT ONBATT jenna@localhost START-TIMER PAGE_Jenna_ONBATT 15 AT ONBATT christina@localhost START-TIMER PAGE_Christina_ONBATT 15 AT ONBATT lindsay@localhost START-TIMER PAGE_Lindsay_ONBATT 15 AT ONBATT britney@localhost START-TIMER PAGE_Britney_ONBATT 15 # When we come back online, cancel any pending battery warnings AT ONLINE barbara@localhost CANCEL-TIMER PAGE_Barbara_ONBATT AT ONLINE paris@localhost CANCEL-TIMER PAGE_Paris_ONBATT AT ONLINE tara@localhost CANCEL-TIMER PAGE_Tara_ONBATT AT ONLINE ashlee@localhost CANCEL-TIMER PAGE_Ashlee_ONBATT AT ONLINE jamie@localhost CANCEL-TIMER PAGE_Jamie_ONBATT AT ONLINE ally@localhost CANCEL-TIMER PAGE_Ally_ONBATT AT ONLINE jenna@localhost CANCEL-TIMER PAGE_Jenna_ONBATT AT ONLINE christina@localhost CANCEL-TIMER PAGE_Christina_ONBATT AT ONLINE lindsay@localhost CANCEL-TIMER PAGE_Lindsay_ONBATT AT ONLINE britney@localhost CANCEL-TIMER PAGE_Britney_ONBATT # Deal with bad communication with the UPS. We use a delay to make # sure that it's not a quick outage caused by somebody swapping cables AT COMMBAD barbara@localhost START-TIMER EMAIL_Barbara_COMMBAD 60 AT COMMBAD barbara@localhost START-TIMER SYSLOG_Barbara_COMMBAD 60 AT COMMBAD paris@localhost START-TIMER EMAIL_Paris_COMMBAD 60 AT COMMBAD paris@localhost START-TIMER SYSLOG_Paris_COMMBAD 60 AT COMMBAD tara@localhost START-TIMER EMAIL_Tara_COMMBAD 60 AT COMMBAD tara@localhost START-TIMER SYSLOG_Tara_COMMBAD 60 AT COMMBAD ashlee@localhost START-TIMER EMAIL_Ashlee_COMMBAD 60 AT COMMBAD ashlee@localhost START-TIMER SYSLOG_Ashlee_COMMBAD 60 AT COMMBAD jamie@localhost START-TIMER EMAIL_Jamie_COMMBAD 60 AT COMMBAD jamie@localhost START-TIMER SYSLOG_Jamie_COMMBAD 60 AT COMMBAD ally@localhost START-TIMER EMAIL_Ally_COMMBAD 60 AT COMMBAD ally@localhost START-TIMER SYSLOG_Ally_COMMBAD 60 AT COMMBAD jenna@localhost START-TIMER EMAIL_Jenna_COMMBAD 60 AT COMMBAD jenna@localhost START-TIMER SYSLOG_Jenna_COMMBAD 60 AT COMMBAD christina@localhost START-TIMER EMAIL_Christina_COMMBAD 60 AT COMMBAD christina@localhost START-TIMER SYSLOG_Christina_COMMBAD 60 AT COMMBAD lindsay@localhost START-TIMER EMAIL_Lindsay_COMMBAD 60 AT COMMBAD lindsay@localhost START-TIMER SYSLOG_Lindsay_COMMBAD 60 AT COMMBAD britney@localhost START-TIMER EMAIL_Britney_COMMBAD 60 AT COMMBAD britney@localhost START-TIMER SYSLOG_Britney_COMMBAD 60 # Once communication is restored, cancel the timer AT COMMOK barbara@localhost CANCEL-TIMER EMAIL_Barbara_COMMBAD AT COMMOK barbara@localhost CANCEL-TIMER SYSLOG_Barbara_COMMBAD AT COMMOK paris@localhost CANCEL-TIMER EMAIL_Paris_COMMBAD AT COMMOK paris@localhost CANCEL-TIMER SYSLOG_Paris_COMMBAD AT COMMOK tara@localhost CANCEL-TIMER EMAIL_Tara_COMMBAD AT COMMOK tara@localhost CANCEL-TIMER SYSLOG_Tara_COMMBAD AT COMMOK ashlee@localhost CANCEL-TIMER EMAIL_Ashlee_COMMBAD AT COMMOK ashlee@localhost CANCEL-TIMER SYSLOG_Ashlee_COMMBAD AT COMMOK jamie@localhost CANCEL-TIMER EMAIL_Jamie_COMMBAD AT COMMOK jamie@localhost CANCEL-TIMER SYSLOG_Jamie_COMMBAD AT COMMOK ally@localhost CANCEL-TIMER EMAIL_Ally_COMMBAD AT COMMOK ally@localhost CANCEL-TIMER SYSLOG_Ally_COMMBAD AT COMMOK jenna@localhost CANCEL-TIMER EMAIL_Jenna_COMMBAD AT COMMOK jenna@localhost CANCEL-TIMER SYSLOG_Jenna_COMMBAD AT COMMOK christina@localhost CANCEL-TIMER EMAIL_Christina_COMMBAD AT COMMOK christina@localhost CANCEL-TIMER SYSLOG_Christina_COMMBAD AT COMMOK lindsay@localhost CANCEL-TIMER EMAIL_Lindsay_COMMBAD AT COMMOK lindsay@localhost CANCEL-TIMER SYSLOG_Lindsay_COMMBAD AT COMMOK britney@localhost CANCEL-TIMER EMAIL_Britney_COMMBAD AT COMMOK britney@localhost CANCEL-TIMER SYSLOG_Britney_COMMBAD