1UPSC(8) NUT Manual UPSC(8)
2
3
4
6 upsc - example lightweight UPS client
7
9 upsc -l | -L [host]
10
11 upsc ups [variable]
12
13 upsc -c ups
14
16 upsc is provided as a quick way to poll the status of a UPS server. It
17 can be used inside shell scripts and other programs that need UPS data
18 but don’t want to include the full interface.
19
21 -l host
22 List all UPS names configured at host, one name per line. The
23 hostname defaults to "localhost". You may optionally add a colon
24 and a port number.
25
26 -L host
27 As above, list all UPS names configured at host, including their
28 description provided by the remote upsd(8) from ups.conf(5). The
29 hostname defaults to "localhost". You may optionally add a colon
30 and a port number to override the default port.
31
32 -c ups
33 Lists each client connected on ups, one name per line.
34
35 ups
36 Display the status of that UPS. The format for this option is
37 upsname[@hostname[:port]]. The default hostname is "localhost".
38
39 variable
40 Display the value of this variable only. By default, upsc retrieves
41 the list of variables from the server and then displays the value
42 for each. This may be useful in shell scripts to save an additional
43 pipe into grep.
44
46 To list all variables on an UPS named "myups" on a host called "mybox",
47 with upsd(8) running on port 1234:
48
49 $ upsc myups@mybox:1234
50 battery.charge: 100.0
51 battery.voltage: 13.9
52 battery.voltage.nominal: 13.6
53 . . .
54
55 To list the UPSes configured on this system, along with their
56 descriptions:
57
58 $ upsc -L
59 apc: Back-UPS 500
60 ppro2: Patriot Pro II
61
62 To retrieve the status for all UPSes connected to mybox, using
63 Bourne-shell syntax:
64
65 $ for UPS in `upsc -l mybox:1234`; do
66 upsc $UPS ups.status
67 done
68
69 To list clients connected on "myups":
70
71 $ upsc -c myups
72 127.0.0.1
73 ::1
74 192.168.1.2
75
77 If you run this program inside a shell script or similar to get the
78 list of devices and variables, you should only consider using output
79 from stdout, not stderr.
80
82 upsc will either print a list of UPS names, a list of all supported
83 variables and their values on the UPS, or an error message. If you
84 receive an error, make sure you have specified a valid UPS on the
85 command line, that upsd(8) is really running on the other host and that
86 no firewalls are blocking you.
87
89 Earlier versions of this program used the upsfetch library and UDP
90 sockets to talk to upsd. This version of upsc uses the new upsclient
91 library, which only talks TCP. This is why upsct no longer exists.
92
94 upsd(8)
95
96 Internet resources:
97 The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
98
99
100
101Network UPS Tools 2.8.0 04/26/2022 UPSC(8)