Chapter 15: Advanced Configuration
For power and alarm sensor alerts (power load, and battery charge
For an interface failover
All of these scripts do a check to see whether you have created a custom script to run instead. The code that does this check is shown below (an extract from the
#If there's a
for (( i=0 ; i < ${#scripts[@]} ; i++ )); do
if [
exec /bin/sh "${scripts[$i]}"
fi
done
This code shows that there are two alternative scripts that can be run instead of the default one. This code first checks whether a file
As an example, you can copy
#cd /
#mkdir /etc/config/scripts (if the directory does not already exist)
#
The next step will be to edit the new script file. First, open the
!
For example, we have an RPC (PDU) connected to port 1 on a console server and also have some telecommunications device connected to port 2 (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 specific error, and the only way to fix this error is to power cycle the telecom device.
The first step is to setup a
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)
#
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 an RPC device in order to power cycle our telecom device:
#pmpower
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.
!
If you want 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
/bin/sh /etc/scripts/alert-email $suffix &
If you want 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, consider the
137 |