ups_monitor - Monitors the Uninterruptable Power Supply (UPS) for low battery conditions during a power failure.

SYNOPSIS

ups_monitor
ups_monitor delay {battery_level temperature_limit}
DESCRIPTION
ups_monitor is used to determine the state of power supplied to the system when an Uninterruptable Power Supply (UPS) is attached to the system. The program polls the UPS attached to the system continuously via a serial interface. When a power failure occurs, the UPS switches to battery operation. ups_monitor monitors the battery condition during the power failure. When the battery reaches battery_level percent of its capacity, ups_monitor executes the script "$TSCANROOT/bin/power_mon". This script contains the following commands:
    #    $TSCANROOT/bin/power_mon    Example
    #
    echo "Power Failure Shutdown"
    init 0
Note that the actual shutdown of the UPS may be delayed by using the p command.  Also, the UPS may not actually re-supply power to the computer until the following criteria are met:
  1. The battery level reaches the percent specified by the e command.

  2.             and
  3. The time delay specified by the r command has occurred.
This command must be run by the root user to invoke the shutdown script. The function can be run by any user to check the correct operation of the shutdown monitoring by the UPS. The diagnostic ups should be used to test the UPS itself. The environment variable ANT_DEBUG must be set to a value of 2 to see the diagnostics received from the UPS.

The messages issued by ups_monitor are stored in the logging file $PASSDIR/schedlog. They are:

   Begin UPS monitoring. Battery cutoff level = 20 %
   Now on Battery. Shutdown begins when battery reaches 20%.

   Low Battery. Battery level 20%. XX System is shutting down.
   Now on normal power.            - Issued when mains power is restored.
   No reply from UPS to shutdown UPS.
The following entries in  system.config must be defined in order to run ups_monitor:
  1. Device name of the serial port attached to the UPS. Example: [system]ups.device: /dev/term/2
  2. Type of UPS.  Example: [system]ups.index: su
UPS Types:  ( The word or the number may be used )
  gold = 1 = Emerson GOLD UPS
  su    = 2 = APC Smart UPS (AP or SU series)

The file $PASSDIR/ups_lock_dev_term_X (as defined in system.config as [system]ups.device) must be defined so that two copies of this function (or the function ups) can run. Any "/" in the device name will be replaced by "_" for the lock file name. It is a zero length file with read/write permissions.

PARAMETERS

delay
Specifies the time delay (in seconds) before reading the current status from the UPS. The default is 3 seconds.
battery_level
Specifies the percent of battery capacity that causes the ups_monitor to initiate the system shutdown.  The delay parameter must precede this parameter. The default is 20 percent.  Some systems may need a larger value than 20 percent battery capacity to safely shut down the system.

This is an optional parameter, entered as an integer.

temperature_limit
Specifies the internal temperature alarm limit of the UPS.    When this temperature is reached, an alarm message is issued.  When the temperature drops below this limit, a message is issued is issued stating a return to normal. The delay and battery_level parameters must precede this parameter. The default temperature is 45 degrees C.

This is an optional parameter, entered as an integer.

EXAMPLES

 Read the current UPS state forever,  testing every 3 seconds, waiting for a change.
[1]%ups_monitor &
 Run the test forever, testing every 5 seconds.
[2]%ups_monitor 5 &
 Run the test forever, testing every 5 seconds, shutdown at 30% battery capacity.
[3]%ups_monitor  5 30 &
Run the test forever, testing every 5 seconds, shutdown at 30% battery capacity, alarm at 35 degrees C.
[3]%ups_monitor  5 30 35&

FILES

$PASSDIR/schedlog,   system.config, $PASSDIR/ups_lock_dev_term_X

SEE ALSO

tscan.login ups

NOTES

USE OF THIS COMMAND MAY SLOW DOWN THE SYSTEM'S PERIODIC REQUEST TO THE UPS.  THIS COMMAND CAN BE RUN WHEN THE DIAGNOSTIC ups IS RUNNING.

Last Update: $Date: 1999/09/09 20:48:46 $