upswatch - watches an UPS using an Hardware::UPS::Perl driver indirectly via TCP or directly on a serial device
upswatch [ -h, --help ] [ -M, --man ] [ -V, --version ] [ -D, --driver driver ] [ -d, --debug-level [debuglevel] ] [ -g, --grace-period grace ] [ -L, --logfile logfile ] [ -l, --loop-time loop ] [ -m, --mailto mailto ] [ -p, --pidfile pidfile ] [ -r, --remote [HOST:[PORT] ] [device-name]
upswatch watches an UPS using a driver specified on the command line. There are to ways of operating:
On the one hand, the UPS can reside on a local serial device specified by the optional device-name parameter. If the parameter is omitted, /dev/ttyS0, i.e. the COM1 port, is used per default unless overriden by the environment variable UPS_DEVICE.
On the other hand, the UPS can be watched via TCP/IP, if there is an UPS agent running at a remote host specified by the --remote option.
The program examines the UPS every loop seconds. For a period of one hour the minimum and maximum line voltage and frequency are determined. At each full hour these values are written to the syslog.
If the line voltage fails, the computer will be shutdown down savely after a grace period of grace minutes. If the line voltage returns within this period of time, the program will switch back to standard monitoring. Both events will be noted in the syslog. If a mail address mailto is provided, a mail will be sent to the corresponding recipient. This will be the case as well if the environment variable UPS_MAILTO is set.
All messages will be logged in a logfile specified by the -L or --logfile option, if available, /var/run/upswatch.log, otherwise.
Displays a short usage help message and exits without errors.
Displays the embedded pod documentation of upswatch (this screen) using pod2man, groff and less as pager; it exits without errors.
Displays version information and exits without errors.
Sets the UPS driver driver to use. driver is a case-insensitive string. If not specified, the default driver "Megatec" is used.
Sets the integer debug level debuglevel. If the debug level is not specified, a default of 1 is assumed. A higher debug level will increase the verbosity. The maximum is 5. If the debug level option is used the system will not shutdown automatically.
Sets the grace period grace in minutes after that the system will be safely shutdown, if the line voltages failes. If not specified, a default value of 5 minutes is used.
Sets the logfile to logfile. If this option is not specified, the default logfile /var/run/upswatch.log will be used.
Sets the loop time loop in seconds, the UPS is examined. If not specified, a default value of 10 seconds is used.
Sets the mail address to mailto. If not specified, no mail will be sent at all unless the environment variable UPS_MAILTO is set.
Sets the PID file to pidfile. If this option is not specified, the default PID file /var/run/upswatch.pid will be used.
Switches to the remote operation modus, i.e. the UPS is watched via TCP/IP using a remotely running UPS agent. The remote site is specified by the HOST and optionally the TCP port PORT separated by ':'. If not specified, the local host's default FQDN will be used together with default TCP port 9050.
Monitors the UPS on COM1 every 10 seconds and performes a safe shutdown, if the line voltage fails for more than 5 minutes.
Monitors the UPS on COM2 every 20 seconds with a grace time of 10 minutes, before the system will be shutdown in case of line voltage failure.
Monitors the UPS located at host 192.168.1.2 via an UPS agent listening at TCP port 7030 at this host.
groff(1), less(1), pod2man(1), upsadm(1), upsagent(1), upsstat(1), Getopt::Long(3pm), Time::HiRes(3pm), Hardware::UPS::Perl::Connection(3pm), Hardware::UPS::Perl::Connection::Net(3pm), Hardware::UPS::Perl::Connection::Serial(3pm), Hardware::UPS::Perl::Constants(3pm), Hardware::UPS::Perl::Driver(3pm), Hardware::UPS::Perl::Driver::Megatec(3pm), Hardware::UPS::Perl::General(3pm), Hardware::UPS::Perl::Logging(3pm), Hardware::UPS::Perl::PID(3pm), Hardware::UPS::Perl::Utils(3pm)
Bernd Holzhauer, firstname.lastname@example.org Christian Reile, Christian.Reile@t-online.de