upsstat - gets informations about the UPS using an Hardware::UPS::Perl driver indirectly via TCP or directly on a serial device


upsstat [ -h, --help ] [ -M, --man ] [ -V, --version ] [ -D, --driver driver ] [ -d, --debug-level [debuglevel] ] [ -r, --remote [HOST:[PORT] ] [ -a, --all ] [ -c, --comparison ] [ -i, --info ] [ -s, --status ] [device-name]


upsstat gets informations about an UPS itself, its current status and the comparison between the rating and current data using a driver specified on the command line and prints them to STDOUT. 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 informations can be retrieved via TCP/IP, if there is an UPS agent running at a remote host specified by the --remote option.


-h, --help

Displays a short usage help message and exits without errors.

-M, --man

Displays the embedded pod documentation of upswatch (this screen) using pod2man, groff and less as pager; it exits without errors.

-V, --version

Displays version information and exits without errors.

-D, --driver driver

Sets the UPS driver driver to use. driver is a case-insensitive string. If not specified, the default driver "Megatec" is used.

-d, --debug-level [debuglevel]

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.

-r, --remote [HOST[:PORT]]

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.

-a, --all

Gets all UPS informations available.

-c, --comparison

Gets the comparison between the rating info (firmware data) and the current data of the UPS.

-i, --info

Gets the UPS informations, i.e. the manufacturer, model and the firmware version.

-s, --status

Gets the current UPS status informations; this is the default.



Retrieves the status of an UPS on COM1.

upsstat /dev/ttyS1

Retrieves the status of an UPS on COM2.

upsstat -r

Connects to an UPS located at host via an UPS agent listening at TCP port 7030 at this host and retrieves its status.


groff(1), less(1), pod2man(1), upsadm(1) upsagent(1), upswatch(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)


Christian Reile,