'\" t
.\" Title: failover
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 08/13/2025
.\" Manual: NUT Manual
.\" Source: Network UPS Tools 2.8.4
.\" Language: English
.\"
.TH "FAILOVER" "8" "08/13/2025" "Network UPS Tools 2\&.8\&.4" "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"
failover \- UPS Failover Driver
.SH "SYNOPSIS"
.sp
\fBfailover\fR \-h
.sp
\fBfailover\fR \-a \fIUPS_NAME\fR [\fIOPTIONS\fR]
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.sp
This man page only documents the specific features of the failover driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&.
.sp .5v
.RE
.SH "DESCRIPTION"
.sp
The failover driver acts as a smart proxy for multiple "real" UPS drivers\&. It connects to and monitors these underlying UPS drivers through their local UNIX sockets (or Windows named pipes), continuously evaluating health and suitability for "primary" duty according to a set of user configurable rules and priorities\&.
.sp
At any given time, failover designates one UPS driver as the \fBprimary\fR, and presents its commands, variables and status to the outside world as if it were directly talking to that UPS\&. From the perspective of the clients (such as \fBupsmon\fR(8) or \fBupsc\fR(8)), the failover driver behaves like any single UPS, abstracting away the underlying redundancy, and allowing for seamless transitioning between all monitored UPS drivers and their datasets\&.
.sp
The driver dynamically promotes or demotes the primary UPS driver based on:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Socket availability and communication status
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Data freshness and UPS online/offline indicators
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
User\-defined status filters (e\&.g\&., presence or absence of
OL,
LB, \&...)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Administrative override via control commands (force\&.primary,
force\&.ignore)
.RE
.sp
If the current primary becomes unavailable or no longer meets the criteria, the driver automatically fails over to a more suitable driver\&. During transitions, it ensures that any data is switched out instantly, without the \fBupsd\fR(8) considering it as stale or the clients acting on any previously degraded status\&.
.sp
When no suitable primary is available, a configurable fallback state is entered:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Keep last primary and declare the data as stale
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Raise
ALARM
and declare the data as stale
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Raise
ALARM
and set forced shutdown (FSD)
.RE
.sp
Different communication media can be used to connect to individual UPS drivers (e\&.g\&., USB, Serial, Ethernet)\&. failover communicates directly at the socket level and therefore does not rely on \fBupsd\fR(8) being active\&.
.SH "EXTRA ARGUMENTS"
.sp
This driver supports the following settings:
.PP
\fBport\fR=\fIdrivername\-devicename,drivername2\-devicename2,\&...\fR
.RS 4
Required\&. Specifies the local sockets (or Windows named pipes) of the underlying UPS drivers to be tracked\&. Entries must either be a path or follow the format
drivername\-devicename, as used by NUT\(cqs internal socket naming convention (e\&.g\&.
usbhid\-ups\-myups)\&. Multiple entries are comma\-separated with no spaces\&.
.RE
.PP
\fBinittime\fR=\fIseconds\fR
.RS 4
Optional\&. Sets a grace period after driver startup during which the absence of a primary is tolerated\&. This allows time for underlying drivers to initialize\&. For networked connections or drivers that require "lock\-picking" their communication protocol, consider increasing this value to accommodate potential longer delays\&. Defaults to 30 seconds\&.
.RE
.PP
\fBdeadtime\fR=\fIseconds\fR
.RS 4
Optional\&. Sets a grace period in seconds after which a non\-responsive UPS driver is considered dead\&. Defaults to 30 seconds\&.
.RE
.PP
\fBrelogtime\fR=\fIseconds\fR
.RS 4
Optional\&. Time interval in which repeated connection failure logs are emitted for a UPS, reducing log spam during unstable conditions\&. Defaults to 5 seconds\&.
.RE
.PP
\fBnoprimarytime\fR=\fIseconds\fR
.RS 4
Optional\&. Duration to wait without a suitable primary UPS driver before entering the configured fallback mode (fsdmode)\&. Defaults to 15 seconds\&.
.RE
.PP
\fBmaxconnfails\fR=\fIcount\fR
.RS 4
Optional\&. Number of consecutive connection failures allowed per UPS driver before entering into the cooldown period (coolofftime)\&. Defaults to 5\&.
.RE
.PP
\fBcoolofftime\fR=\fIseconds\fR
.RS 4
Optional\&. Cooldown period during which the driver pauses reconnect attempts after exceeding
maxconnfails\&. Defaults to 15 seconds\&.
.RE
.PP
\fBfsdmode\fR=\fI0|1|2\fR
.RS 4
Optional\&. Defines the behavior when no suitable primary UPS driver is found after
noprimarytime
has elapsed\&. Defaults to 0\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
0:
\fBDo not demote the last primary, but mark its data as stale\&.\fR
This is similar to how a regular UPS driver would behave when it loses its connection to the target UPS device\&.
\fBupsmon\fR(8)
will act on the last known (online or not) status, and decide itself whether that UPS should be considered critical\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
1:
\fBDemote the primary, raise \fR\fBALARM\fR\fB, and mark the data as stale after an additional few seconds have elapsed (ensuring full propagation)\&.\fR
This will cause
\fBupsmon\fR(8)
to detect that a device previously in an alarm state has lost its connection, consider the UPS driver critical, and possibly trigger a forced shutdown (FSD) due to depletion of
MINSUPPLIES\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
2:
\fBDemote the primary, raise \fR\fBALARM\fR\fB, and immediately set \fR\fBFSD\fR\fB\&.\fR
This will set
FSD
from the driver side and preempt
\fBupsmon\fR(8)
from raising it itself\&. This mode is for setups where immediate shutdown is warranted, regardless of anything else, and getting
FSD
out to the clients as fast as just possible\&.
.RE
.RE
.PP
\fBcheckruntime\fR=\fI0|1|2|3\fR
.RS 4
Optional\&. Controls how
battery\&.runtime
values are used to break ties between non\-fully\-online UPS devices
\fBat priority 3 or lower\fR\&. Has no effect on initial priority selection or when
strictfiltering
is enabled\&. Defaults to 1\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
0:
\fBDisabled\&.\fR
No runtime comparison is done\&. The first candidate with the best priority is selected according to the order of the port argument\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
1:
\fBCompare \fR\fBbattery\&.runtime\fR\fB\&.\fR
The UPS with the higher value is preferred\&. If the value is missing or invalid, the UPS cannot win the tie\-break\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
2:
\fBCompare \fR\fBbattery\&.runtime\&.low\fR\fB\&.\fR
The UPS with the higher value is preferred\&. If the value is missing or invalid, the UPS cannot win the tie\-break\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
3:
\fBCompare both variables strictly\&.\fR
The UPS is preferred only if it has both a higher
battery\&.runtime
and
battery\&.runtime\&.low
value\&. If either is missing or invalid, the UPS cannot win the tie\-break\&.
.RE
.RE
.PP
\fBstrictfiltering\fR=\fI0|1\fR
.RS 4
Optional\&. If set to 1, only UPS drivers matching the configured status filters are considered for promotion to primary\&. If set to 0, the hard\-coded default logic is also considered when no status filters match (read more about this in the section
PRIORITIES)\&. Defaults to 0\&.
.RE
.PP
\fBstatus_have_any\fR=\fIOL,CHRG,\&...\fR
.RS 4
Optional\&. If any of these comma\-separated tokens are present in a UPS driver\(cqs
ups\&.status, it passes this status filtering criteria\&. Defaults to unset\&.
.RE
.PP
\fBstatus_have_all\fR=\fIOL,CHRG,\&...\fR
.RS 4
Optional\&. All listed comma\-separated tokens must be present in
ups\&.status
for the UPS driver to pass this status filtering criteria\&. Defaults to unset\&.
.RE
.PP
\fBstatus_nothave_any\fR=\fIOB,OFF,\&...\fR
.RS 4
Optional\&. If any of these comma\-separated tokens are present in
ups\&.status, the UPS driver does not pass this status filtering criteria\&. Defaults to unset\&.
.RE
.PP
\fBstatus_nothave_all\fR=\fIOB,LB,\&...\fR
.RS 4
Optional\&. If all of these comma\-separated tokens are present in
ups\&.status, the UPS driver does not pass this status filtering criteria\&. Defaults to unset\&.
.RE
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.sp
The status_* arguments are primarily intended to adjust the weighting of UPS drivers, allowing some to be prioritized over others based on their status\&. For example, a driver reporting OL might be preferred over one reporting ALARM OL\&. While strictfiltering can be enabled, status filters are most effective when used in combination with the default set of connectivity\-based PRIORITIES\&. For more details, see the respective section further below\&.
.sp .5v
.RE
.SH "IMPLEMENTATION"
.sp
The port argument in the \fBups.conf\fR(5) should reference the local driver sockets (or Windows named pipes) that the "real" UPS drivers are using\&. A basic default setup with multiple drivers could look like this:
.sp
.if n \{\
.RS 4
.\}
.nf
[realups]
driver = usbhid\-ups
port = auto
[realups2]
driver = usbhid\-ups
port = auto
[failover]
driver = failover
port = usbhid\-ups\-realups,usbhid\-ups\-realups2
.fi
.if n \{\
.RE
.\}
.sp
Any \fBupsmon\fR(8) clients would be set to monitor the failover UPS\&.
.sp
The driver fully supports setting variables and performing instant commands on the currently elected primary UPS driver, which are proxied and with end\-to\-end tracking also being possible (\fBupscmd\fR(8) and \fBupsrw\fR(8) \-w)\&. You may notice some variables and commands will be prefixed with upstream\&., this is to clearly separate the upstream commands from those of failover itself\&.
.sp
For your convenience, additional administrative commands are exposed to directly influence and override the primary election process, e\&.g\&. for maintenance:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\&.force\&.ignore [seconds]
prevents the specified UPS driver from being selected as primary for the given duration, or permanently if a negative value is used\&. A value of
0
resets this override and re\-enables selection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\&.force\&.primary [seconds]
forces the specified UPS driver to be treated with the highest priority for the given duration, or permanently if a negative value is used\&. A value of
0
resets this override\&.
.RE
.sp
Calling either command without an argument has the same effect as passing 0, but only for that specific override \- it does not affect the other\&.
.SH "PRIORITIES"
.sp
As outlined above, primaries are dynamically elected based on their current state and according to a strict set of user influenceable priorities, which are:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
0
(highest): UPS driver was forced to the top by administrative command\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
1: UPS driver has passed the user\-defined status filters\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
2: UPS driver has fresh data and is online (in status
OL)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
3: UPS driver has fresh data, but may not be fully online\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
4
(lowest): UPS driver is alive, but may not have fresh data\&.
.RE
.sp
The UPS driver with the highest calculated priority is chosen as primary, ties are resolved through order of the socket names given within the port argument\&.
.sp
For the user\-defined status filters, the following internal order is respected:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 1." 4.2
.\}
status_nothave_any
(first)
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 2." 4.2
.\}
status_have_all
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 3." 4.2
.\}
status_nothave_all
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 4." 4.2
.\}
status_have_any
(last)
.RE
.sp
If strictfiltering is enabled, priorities 2 to 4 are not applicable\&.
.sp
If no user\-defined status filters are set, the priority 1 is not applicable\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.sp
The base requirement for any election is the UPS socket being connectable and the UPS driver having published at least one full batch of data during its lifetime\&. UPS driver not fulfilling that requirement are always disqualified\&.
.sp .5v
.RE
.SH "RATIONALE"
.sp
In complex power environments, presenting a single, consistent source of UPS information to \fBupsmon\fR(8) is sometimes preferable to monitoring multiple independent drivers directly\&. The failover driver serves as a bridge, allowing \fBupsmon\fR(8) to make decisions based on the most suitable available data, without having to interpret conflicting inputs or degraded sources\&.
.sp
Originally designed for use cases such as dual\-PSU systems or redundant communication paths to a single UPS, failover also supports more advanced setups \- for example, when multiple UPSes feed a shared downstream load (via STS/ATS switches), or when drivers vary in reliability\&. In these cases, the driver can be combined with external logic or scripting to dynamically adjust primary selection and facilitate graceful degradation\&. Such setups may also benefit from further integration with the clone family of drivers, such as \fBclone\fR(8) or \fBclone-outlet\fR(8), for greater granularity and monitoring control down to the outlet level\&.
.sp
Additionally, in more niche scenarios, some third\-party NUT integrations or graphical interfaces may be limited to monitoring a single UPS device\&. In such cases, failover can help by exposing only the most relevant or highest\-priority data source, allowing those tools to operate within their constraints without missing critical information\&.
.sp
Ultimately, this driver enables more nuanced power monitoring and control than binary online/offline logic alone, allowing administrators to respond to degraded conditions early \- before they escalate into critical events or require \fBupsmon\fR(8) to take action\&.
.SH "LIMITATIONS"
.sp
When using failover for redundancy between multiple UPS drivers connected to the same underlying UPS device, data is not multiplexed between the drivers\&. As a result, some data points may be available in some drivers but not in others\&.
.sp
For checkruntime considerations, the unit of both battery\&.runtime and battery\&.runtime\&.low is assumed to be \fBseconds\fR\&. UPS drivers that report these values using different units are considered non\-compliant with the NUT variable standards and should be reported to the NUT developers as faulty\&.
.SH "AUTHOR"
.sp
Sebastian Kuttnig
.SH "SEE ALSO"
.sp
\fBupscmd\fR(8), \fBupsrw\fR(8), \fBups.conf\fR(5), \fBupsc\fR(8), \fBupsmon\fR(8), \fBnutupsdrv\fR(8), \fBclone\fR(8), \fBclone-outlet\fR(8)
.SS "Internet Resources:"
.sp
The NUT (Network UPS Tools) home page: https://www\&.networkupstools\&.org/historic/v2\&.8\&.4/