File: upsd.txt

package info (click to toggle)
nut 2.8.4%2Breally-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,720 kB
  • sloc: ansic: 132,030; sh: 17,256; cpp: 12,566; makefile: 5,646; python: 1,114; perl: 856; xml: 47
file content (221 lines) | stat: -rw-r--r-- 7,555 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
UPSD(8)
=======

NAME
----

upsd - Network UPS Tools data server

SYNOPSIS
--------

*upsd* -h

*upsd* ['OPTIONS']

DESCRIPTION
-----------

*upsd* is responsible for serving the data from the drivers to the clients.
It connects to each driver and maintains a local cache of the current state.
Queries from the clients are served from this cache, so delays are minimal.

It also conveys administrative messages from the clients back to the drivers,
such as starting tests, or setting values.

Communication between *upsd* and clients is handled on a TCP port.
Configuration details for this port are described in linkman:upsd.conf[5].

This program is essential, and must be running at all times to actually
make any use out of the drivers and clients (except for final UPS power-off
commands just before your server goes down, which NUT driver programs can
do alone when called as `drivername -k` in a shutdown hook or late ordered
SysV init script).

Controls in the configuration files allow you to limit access to the
server, but you should also use a firewall for extra protection.  Client
processes such as linkman:upsmon[8] trust *upsd* for status information about
the UPS hardware, so keep it secure.

OPTIONS
-------

*-c* 'command'::
Send 'command' to the background process as a signal.  Valid commands
are:

	*reload*;; reread configuration files
	*stop*;; stop process and exit

*-P* 'pid'::
Send the command signal above using specified PID number, rather than
consulting the PID file.  This can help define service units which
start `upsd` as a foreground process so it does not create a PID file.
See also `-FF` option as an alternative.

*-D*::
Raise the debugging level.  upsd will run in the foreground by default,
and will print information on stdout about the monitoring process.
Use this option multiple times for more details.

*-F*::
upsd will run in the foreground, regardless of debugging settings.
Specify twice (`-FF` or `-F -F`) to save the PID file even in this mode.

*-B*::
upsd will run in the background, regardless of debugging settings.

*-h*::
Display the help text.

*-r* 'directory'::
upsd will linkmanext:chroot[2] to 'directory' shortly after startup
and before parsing any configuration files with this option set.
You can use this to create a "jail" for greater security.
+
You must coordinate this with your drivers, as upsd must be able to find
the state path within 'directory'.  See linkman:upsdrvctl[8] and
linkman:nutupsdrv[8].

*-u* 'user'::
Switch to user 'user' after startup if started as root.
This overrides whatever you may have compiled in with `configure --with-user`.

*-V*::
Display the version of the program.

RELOADING
---------

upsd can reload its configuration files without shutting down the process
if you send it a SIGHUP or start it again with `-c reload`.  This only works
if the background process is able to read those files (permissions, `chroot`
jail), and if the daemon did save a PID file when it started (for the `reload`
command to find the older instance).

[NOTE]
======
Service instances wrapped by systemd or SMF might not save them by default --
use respective `reload`/`refresh` framework actions instead then), e.g.
`systemctl reload nut-server`

NUT releases after 2.8.0 define aliases for these units, so if your Linux
distribution uses NUT-provided unit definitions, `systemctl reload upsd`
may also work.
======

If you think that `upsd` can't reload, check your syslog for error messages.
If it's complaining about not being able to read the files, then you need
to adjust your system to make it possible.  Either change the permissions
on the files, or run `upsd` as another user that will be able to read them,
or restart it fully (may be needed e.g. if running in a `chroot` jail).

DO NOT make your linkman:upsd.conf[5] or linkman:upsd.users[5] files
world-readable, as they hold important authentication information.
In the wrong hands, it could be used by some evil person to spoof
your primary-mode `upsmon` and command your systems to shut down,
for example.

DIAGNOSTICS
-----------

upsd expects the drivers to either update their status regularly or at
least answer periodic queries, called pings.  If a driver doesn't
answer, upsd will declare it "stale" and no more information will be
provided to the clients.

If upsd complains about staleness when you start it, then either your
driver or configuration files are probably broken.  Be sure that the
driver is actually running, and that the UPS definition in
linkman:ups.conf[5] is correct.  Also make sure that you start your
driver(s) before starting upsd.

Data can also be marked stale if the driver can no longer communicate
with the UPS.  In this case, the driver should also provide diagnostic
information in the syslog.  If this happens, check the serial or
USB cabling, or inspect the network path in the case of a SNMP UPS.

ACCESS CONTROL
--------------

If the server is build with tcp-wrappers support enabled, it will check if
the NUT username is allowed to connect from the client address through the
`/etc/hosts.allow` and `/etc/hosts.deny` files. Note that this will
only be done for commands that require to be logged into the server. Further
details are described in linkmanext:hosts_access[5].

FILES
-----

The general `upsd` configuration file is linkman:upsd.conf[5].

The administrative functions like `SET` and `INSTCMD` for users, and various
`upsmon` roles, are defined and controlled in linkman:upsd.users[5].

UPS definitions are found in linkman:ups.conf[5] (shared with actual drivers).

ENVIRONMENT VARIABLES
---------------------

*NUT_DEBUG_LEVEL* sets default debug verbosity if no *-D* arguments
were provided on command line, but does not request that the daemon
runs in foreground mode.

*NUT_CONFPATH* is the path name of the directory that contains
`upsd.conf` and other configuration files.  If this variable is not set,
*upsd* uses a built-in default, which is often `/usr/local/ups/etc`.

*NUT_STATEPATH* is the path name of the directory in which
*upsd* keeps state information.  If this variable is not set,
*upsd* uses a built-in default, which is often `/var/state/ups`.
The *STATEPATH* directive in linkman:upsd.conf[5] overrides this variable.

*NUT_ALTPIDPATH* is the path name of the directory in which
*upsd* and drivers store .pid files.  If this variable is not set,
*upsd* and drivers use either *NUT_STATEPATH* if set, or ALTPIDPATH if set,
or otherwise the built-in default *STATEPATH*.

*NUT_QUIET_INIT_UPSNOTIFY=true* can be used to prevent daemons which can
notify service management frameworks (such as systemd) about passing
their lifecycle milestones from emitting such notifications (including
those about lack of system support for such modern features, once per run).

*NUT_QUIET_INIT_BANNER=true* can be used to suppress NUT tool name and
version banner. NOT recommended for services due to adverse troubleshooting
impact, but may be helpful in shell profiles or scripts which process NUT
tool outputs.

SEE ALSO
--------

Clients:
~~~~~~~~

- linkman:upsc[8]
- linkman:upscmd[8]
- linkman:upsrw[8]
- linkman:upslog[8]
- linkman:upsmon[8]

CGI programs:
~~~~~~~~~~~~~

- linkman:upsset.cgi[8]
- linkman:upsstats.cgi[8]
- linkman:upsimage.cgi[8]

Driver control:
~~~~~~~~~~~~~~~

include::{builddir}linkman-drivertool-names.txt[]

Drivers:
~~~~~~~~

- linkman:nutupsdrv[8]
include::{builddir}linkman-driver-names.txt[]

Internet resources:
~~~~~~~~~~~~~~~~~~~

The NUT (Network UPS Tools) home page: https://www.networkupstools.org/