- bookworm 2.8.0-7
- testing 2.8.1-5
- unstable 2.8.1-5
- experimental 2.8.3-2
UPSLOG(8) | NUT Manual | UPSLOG(8) |
NAME¶
upslog - UPS status logger
SYNOPSIS¶
upslog -h
upslog [OPTIONS]
DESCRIPTION¶
upslog is a daemon that will poll a UPS at periodic intervals, fetch the variables that interest you, format them, and write them to a file.
The default format string includes variables that are supported by many common UPS models. See the description below to make your own.
OPTIONS¶
-f format
%%
%t
%TIME format%
%ETIME%
%HOST%
%UPSHOST%
%PID%
%VAR varname%
The default format string is:
%TIME @Y@m@d @H@M@S% %VAR battery.charge% %VAR input.voltage% %VAR ups.load% [%VAR ups.status%] %VAR ups.temperature% %VAR input.frequency%
-N
Note
This option DOES NOT currently check if you already have %UPSHOST% in the formatting string (e.g. specified explicitly).
-i interval
If you require tighter timing, consider writing your own logger using the upsclient(3) library.
-d count
-l logfile
You can use - for stdout, but upslog will remain in the foreground by default.
Requires that the -s <system> option is also used for the single-system logging.
Can be used with the -m <tuple>, will be added to the list.
-D
-F
-B
-s ups
The upsname may be an asterisk * to query UPSes currently served by hostname, and monitor each of them (into the same logging destination).
Requires that the -l <logfile> option is also used for the single-system logging.
Can be used with the -m <tuple>, will be added to the list.
-m tuple
The format for this option is a tuple of UPS system and log file specification, separated by commas. An example would be:
upsname@hostname:9999,/var/log/nut/cps.log
The upsname may be an asterisk * to query UPSes currently served by hostname, and monitor each of them (into the same logging destination).
Tuples may specify - as the logfile, to emit messages on stdout (e.g. to be collected by the system journal for services).
Use of stdout via tuple-based logging specifications also implies that upslog will remain in the foreground by default.
-u username
If username is not defined, it will use the value that was compiled into the program. This defaults to nobody (if not otherwise configured), which is far from ideal.
COMMON OPTIONS¶
-h
-V
-W secs
SERVICE DELAYS¶
The interval value is merely the number given to sleep(3) after running through the format string. Therefore, a query will actually take slightly longer than the interval, depending on the speed of your system.
ON-DEMAND LOGGING¶
Sending a SIGUSR1 to a running upslog process makes it wake from the current sleep and log immediately. This is useful when triggered from a upssched event trigger (e.g. AT ONBATT or AT ONLINE) to ensure that an entry always exists, even if the power goes away for a period of time shorter than that specified by the -i argument.
LOG CO-LOCATION¶
It is possible and safe to specify the same log file (including - for stdout) in several tuples, and it would only be opened or closed once without conflict.
Consider adding %UPSHOST% to your custom formatting string (e.g. by using the -N command-line option), in order to easily differentiate lines corresponding to different systems, when logging them to the same target.
LOG ROTATION¶
upslog writes its PID to upslog.pid, and will reopen the log file if you send it a SIGHUP. This allows it to keep running when the log is rotated by an external program.
CAVEATS¶
Historically this daemon supported logging of data for one UPS system per run (specified by the -s option) into one log file name or stdout (specified by the -l option).
Since NUT v2.8.1 it allowed to log several devices (each logged into its individual destination file or common stdout) as specified by multiple -m tuple options. But the two modes were effectively exclusive of each other (single-UPS options were ignored if tuples are also provided).
Since NUT v2.8.3, the single-UPS options are added to the list of tuples, so both legacy and new options can be reliably used to monitor multiple devices in the same run.
SEE ALSO¶
Server:¶
Clients:¶
Internet resources:¶
The NUT (Network UPS Tools) home page: https://www.networkupstools.org/historic/v2.8.3/
07/08/2025 | Network UPS Tools 2.8.3 |