'\" t
.\" Title: ups.conf
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 05/20/2024
.\" Manual: NUT Manual
.\" Source: Network UPS Tools 2.8.2
.\" Language: English
.\"
.TH "UPS\&.CONF" "5" "05/20/2024" "Network UPS Tools 2\&.8\&.2" "NUT Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ups.conf \- UPS definitions for Network UPS Tools
.SH "DESCRIPTION"
.sp
This file is read by the driver controller \fBupsdrvctl\fR(8), the UPS drivers which use the common core (see \fBnutupsdrv\fR(8)), \fBnut-driver-enumerator\fR(8), and the NUT data server \fBupsd\fR(8)\&. The file begins with global directives, and then each UPS has a section which contains a number of directives that set parameters for that UPS\&.
.sp
A UPS section begins with the name of the UPS in brackets, and continues until the next UPS name in brackets or until EOF\&. The name "default" is used internally in upsd, so you can\(cqt use it in this file\&.
.sp
You must define the \fIdriver\fR and \fIport\fR elements for each entry\&. Anything after that in a section is optional\&. A simple example might look like this:
.sp
.if n \{\
.RS 4
.\}
.nf
[myups]
driver = blazer_ser
port = /dev/ttyS0
desc = "Web server UPS"
.fi
.if n \{\
.RE
.\}
.sp
A slightly more complicated version includes some extras for the hardware\-specific part of the driver:
.sp
.if n \{\
.RS 4
.\}
.nf
[bigups]
driver = apcsmart
port = /dev/cua00
cable = 940\-0095B
sdtype = 2
desc = "Database server UPS"
.fi
.if n \{\
.RE
.\}
.sp
In this case, the \fBapcsmart\fR(8) driver will receive variables called "cable" and "sdtype" which have special meanings\&. See the man pages of your driver(s) to learn which variables are supported and what they do\&.
.sp
Here is another example, when connecting a serial UPS on Windows:
.sp
.if n \{\
.RS 4
.\}
.nf
[windows\-ups]
driver = mge\-shut
port = "\e\e\e\e\&.\e\eCOM10"
desc = "UPS on a Windows machine"
.fi
.if n \{\
.RE
.\}
.SH "GLOBAL DIRECTIVES"
.PP
\fBchroot\fR
.RS 4
Optional\&. The driver will chroot(2) to this directory during initialization\&. This can be useful when securing systems\&.
.RE
.PP
\fBdriverpath\fR
.RS 4
Optional\&. Path name of the directory in which the UPS driver executables reside\&. If you don\(cqt specify this, the programs look in a built\-in default directory, which is often /usr/local/ups/bin\&.
.RE
.PP
\fBmaxstartdelay\fR
.RS 4
Optional\&. Same as the UPS field of the same name, but this is the default for UPSes that don\(cqt have the field\&.
.RE
.PP
\fBmaxretry\fR
.RS 4
Optional\&. Specify the number of attempts to start the driver(s), in case of failure, before giving up\&. A delay of
\fIretrydelay\fR
is inserted between each attempt\&. Caution should be taken when using this option, since it can impact the time taken by your system to start\&.
.sp
The default is 1 attempt\&.
.RE
.PP
\fBnowait\fR
.RS 4
Optional\&. Specify to upsdrvctl to not wait at all for the driver(s) to execute the request command\&.
.sp
The default (omission) is to wait\&.
.sp
It can be overridden by
NUT_IGNORE_NOWAIT
environment variable (e\&.g\&. used to work around certain issues with systemd otherwise)\&.
.RE
.PP
\fBretrydelay\fR
.RS 4
Optional\&. Specify the delay between each restart attempt of the driver(s), as specified by
\fImaxretry\fR\&. Caution should be taken when using this option, since it can impact the time taken by your system to start\&.
.sp
The default is 5 seconds\&.
.RE
.PP
\fBpollinterval\fR
.RS 4
Optional\&. The status of the UPS will be refreshed after a maximum delay which is controlled by this setting\&. This is normally 2 seconds\&. This setting may be useful if the driver is creating too much of a load on your monitoring system or network\&.
.sp
Note that some drivers (such as
\fBusbhid-ups\fR(8),
\fBsnmp-ups\fR(8)
and
\fBnutdrv_qx\fR(8)) also have an option called
\fBpollfreq\fR
which controls how frequently some of the less critical parameters are polled\&. Details are provided in the respective driver man pages\&.
.RE
.PP
\fBsynchronous\fR
.RS 4
Optional\&. The drivers work by default in asynchronous mode initially but can fall back to synchronous mode if writes to server socket failed (i\&.e
\fBsynchronous=auto\fR)\&. This means that all data are pushed by the driver on the communication socket to upsd (Unix socket on Unix, Named pipe on Windows) without waiting for these data to be actually consumed\&. With some HW, such as ePDUs, that can produce a lot of data, asynchronous mode may cause some congestion, resulting in the socket to be full, and the driver to appear as not connected\&. In such case, the driver will provide the following debug message:
.sp
.if n \{\
.RS 4
.\}
.nf
write XX bytes to socket Y failed
.fi
.if n \{\
.RE
.\}
.sp
By enabling the
\fIsynchronous\fR
flag (value =
\fIyes\fR), the driver will wait for data to be consumed by upsd, prior to publishing more\&. This can be enabled either globally or per driver\&.
.sp
The default of
\fIauto\fR
acts like
\fIno\fR
(i\&.e\&. asynchronous mode) for backward compatibility of the driver behavior, until communications fail with a "Resource temporarily unavailable" condition, which happens when the driver has many data points to send in a burst, and the server can not handle that quickly enough so the buffer fills up\&.
.RE
.PP
\fBuser\fR
.RS 4
Optional\&. Overrides the compiled\-in default unprivileged username for all NUT device drivers\&. See the discussion of the
\-u
option in
\fBnutupsdrv\fR(8)
for details\&.
.RE
.PP
\fBgroup\fR
.RS 4
Optional\&. Overrides the compiled\-in (and/or global\-section) default unprivileged group name for all NUT device drivers, used for the socket file access\&. See the discussion of the
\-g
option in
\fBnutupsdrv\fR(8)
for details\&. This may be specifically useful for ensuring access to dynamic device filesystem nodes, such as USB (or serial\-over\-USB) hot\-plug support, or with device filesystems re\-generated by an OS for every reboot\&.
.RE
.PP
\fBdebug_min\fR \fIINTEGER\fR
.RS 4
Optional\&. Specify a minimum debug level for all driver daemons, e\&.g\&. for troubleshooting a deployment, without impacting foreground or background running mode directly\&. Command\-line option
\-D
can only increase this verbosity level\&.
.RE
.SH "UPS FIELDS"
.PP
\fBdriver\fR
.RS 4
Required\&. This specifies which program will be monitoring this UPS\&. You need to specify the one that is compatible with your hardware\&. See
\fBnutupsdrv\fR(8)
for more information on drivers in general and pointers to the man pages of specific drivers\&.
.RE
.PP
\fBport\fR
.RS 4
Required\&. This is the serial port where the UPS is connected\&. On a Linux system, the first serial port usually is
\fI/dev/ttyS0\fR\&. On FreeBSD and similar systems, it probably will be
\fI/dev/cuaa0\fR\&. On Windows, the first serial port will be "\e\e\e\e\&.\e\eCOM1" (note the escaped slashes)\&.
.RE
.PP
\fBuser\fR
.RS 4
Optional\&. Overrides the compiled\-in (and/or global\-section) default unprivileged username for a particular NUT device driver\&. See the discussion of the
\-u
option in
\fBnutupsdrv\fR(8)
for details\&. This may be specifically useful for ensuring access to dynamic device filesystem nodes, such as USB (or serial\-over\-USB) hot\-plug support, or with device filesystems re\-generated by an OS for every reboot\&.
.RE
.PP
\fBgroup\fR
.RS 4
Optional\&. Overrides the compiled\-in (and/or global\-section) default unprivileged group name for a particular NUT device driver, used for the socket file access\&. See the discussion of the
\-g
option in
\fBnutupsdrv\fR(8)
for details\&. This may be specifically useful for ensuring access to dynamic device filesystem nodes, such as USB (or serial\-over\-USB) hot\-plug support, or with device filesystems re\-generated by an OS for every reboot\&.
.RE
.PP
\fBsdorder\fR
.RS 4
Optional\&. When you have multiple UPSes on your system, you usually need to turn them off in a certain order\&. upsdrvctl shuts down all the 0s, then the 1s, 2s, and so on\&. To exclude a UPS from the shutdown sequence, set this to \-1\&.
.sp
The default value for this parameter is 0\&.
.RE
.PP
\fBallow_killpower\fR
.RS 4
Optional\&. This allows you to request
driver\&.killpower
instant command, to immediately call the driver\-specific default implementation of
upsdrv_shutdown()
method, for same effect as when a NUT driver is started with
\-k
command\-line flag\&. This option can be toggled with
\fBupsrw\fR(8)
as
driver\&.flag\&.allow_killpower
during run\-time\&.
.RE
.PP
\fBdesc\fR
.RS 4
Optional\&. This allows you to set a brief description that upsd will provide to clients that ask for a list of connected equipment\&.
.RE
.PP
\fBnolock\fR
.RS 4
Optional\&. When you specify this, the driver skips the port locking routines every time it starts\&. This may allow other processes to seize the port if you start more than one accidentally\&.
.sp
You should only use this if your system won\(cqt work without it\&.
.sp
This may be needed on Mac OS X systems\&.
.RE
.PP
\fBignorelb\fR
.RS 4
Optional\&. When you specify this, the driver ignores a low battery condition flag that is reported by the UPS (some devices will switch off almost immediately after setting this flag, or will report this as soon as the mains fails)\&. Instead it will use either of the following conditions to determine when the battery is low:
.sp
.if n \{\
.RS 4
.\}
.nf
battery\&.charge < battery\&.charge\&.low
battery\&.runtime < battery\&.runtime\&.low
.fi
.if n \{\
.RE
.\}
.sp
The idea is to set the battery\&.charge\&.low and/or battery\&.runtime\&.low levels in
\fBups\&.conf\fR
to a value that gives enough time to cleanly shutdown your system:
.sp
.if n \{\
.RS 4
.\}
.nf
override\&.battery\&.charge\&.low = 30
override\&.battery\&.runtime\&.low = 180
.fi
.if n \{\
.RE
.\}
.sp
In order for this to work, your UPS should be able to (reliably) report charge and/or runtime remaining on battery\&. Use with caution!
.RE
.PP
\fBmaxstartdelay\fR
.RS 4
Optional\&. This can be set as a global variable above your first UPS definition and it can also be set in a UPS section\&. This value controls how long upsdrvctl will wait for the driver to finish starting\&. This keeps your system from getting stuck due to a broken driver or UPS\&.
.sp
Note that after this time
upsdrvctl
would just move along with its business (whether retrying the same driver if
maxretry>1, or trying another driver if starting them all, or just eventually exit); however, each such most recently started "stuck" driver process may be further initializing in the background, and might even succeed eventually\&.
.sp
They would not be actively killed by
upsdrvctl
after this timeout expires\&.
.sp
The default is 45 seconds\&.
.RE
.PP
\fBsynchronous\fR
.RS 4
Optional\&. Same as the global directive of the same name, but this is for a specific device\&.
.RE
.PP
\fBusb_set_altinterface\fR[=\fIaltinterface\fR]
.RS 4
Optional\&. Force the USB code to call
usb_set_altinterface(0), as was done in NUT 2\&.7\&.2 and earlier\&. This should not be necessary, since the default for
bAlternateSetting
(as shown in lsusb) is zero on all USB devices seen to date\&. However, this redundant call to
usb_set_altinterface()
prevents certain UPSes from working on Mac OS X\&. If your UPS requires explicitly setting the alternate interface, include this flag, and email the nut\-upsdev list with details about your UPS and operating system\&.
.RE
.PP
\fBusb_config_index\fR, \fBusb_hid_rep_index\fR, \fBusb_hid_desc_index\fR, \fBusb_hid_ep_in\fR, \fBusb_hid_ep_out\fR
.RS 4
Optional\&. Force use of specific interface, endpoint, descriptor index etc\&. numbers, rather than defaulting to 0 (rarely other values in certain drivers for some devices known to use non\-zero numbers)\&. Specified as a hexadecimal number\&.
.sp
As a rule of thumb for
usb_hid_desc_index
discovery, you can see larger
wDescriptorLength
values (roughly 600+ bytes) in reports of
lsusb
or similar tools\&.
.RE
.PP
\fBdefault\&.\fR
.RS 4
Optional\&. Set a default value for which is used in case the UPS doesn\(cqt provide a value, but will be overwritten if a value is available from the UPS:
.sp
.if n \{\
.RS 4
.\}
.nf
default\&.input\&.voltage\&.nominal = 230
.fi
.if n \{\
.RE
.\}
.sp
The above will report the nominal input voltage to be 230, unless the UPS tells us differently\&.
.RE
.PP
\fBoverride\&.\fR
.RS 4
Optional\&. Set a value for that overrides any value that may be read from the UPS\&. Used for overriding values from the UPS that are clearly wrong (some devices report wrong values for battery voltage for instance):
.sp
.if n \{\
.RS 4
.\}
.nf
override\&.battery\&.voltage\&.nominal = 12
.fi
.if n \{\
.RE
.\}
.sp
Use with caution! This will only change the appearance of the variable to the outside world, internally in the UPS the original value is used\&.
.RE
.sp
All other fields are passed through to the hardware\-specific part of the driver\&. See those manuals for the list of what is allowed\&.
.PP
\fBdebug_min\fR \fIINTEGER\fR
.RS 4
Optional\&. Specify a minimum debug level for this driver daemon, e\&.g\&. for troubleshooting a deployment, without impacting foreground or background running mode directly\&. If the global
debug_min
is also set, this driver\-level setting overrides it\&. Command\-line option
\-D
can only increase this verbosity level\&.
.RE
.SH "INTEGRATION"
.sp
\fBupsdrvctl\fR(8) uses this file to start and stop the drivers\&.
.sp
The drivers themselves also obtain configuration data from this file\&. Each driver looks up its section and uses that to configure itself\&.
.sp
\fBupsd\fR(8) learns about which UPSes are installed on this system by reading this file\&. If this system is called "doghouse" and you have defined a UPS in your \fBups\&.conf\fR called "snoopy", then you can monitor it from \fBupsc\fR(8) or similar as "snoopy@doghouse"\&.
.SH "SEE ALSO"
.sp
\fBupsd\fR(8), \fBnutupsdrv\fR(8), \fBupsdrvctl\fR(8), \fBupsdrvsvcctl\fR(8)
.SS "Internet resources"
.sp
The NUT (Network UPS Tools) home page: https://www\&.networkupstools\&.org/