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
14 upsc is provided as a quick way to poll the status of a UPS server. It
15 can be used inside shell scripts and other programs that need UPS data
16 but don’t want to include the full interface.
17
19 -l host
20 List all UPS names configured at host, one name per line. The
21 hostname defaults to "localhost". You may optionally add a colon
22 and a port number.
23
24 -L host
25 As above, list all UPS names configured at host, including their
26 description provided by the remote upsd(8) from ups.conf(5). The
27 hostname defaults to "localhost". You may optionally add a colon
28 and a port number to override the default port.
29
30 ups
31 Display the status of that UPS. The format for this option is
32 upsname[@hostname[:port]]. The default hostname is "localhost".
33
34 variable
35 Display the value of this variable only. By default, upsc retrieves
36 the list of variables from the server and then displays the value
37 for each. This may be useful in shell scripts to save an additional
38 pipe into grep.
39
41 To list all variables on an UPS named "myups" on a host called "mybox",
42 with upsd(8) running on port 1234:
43
44 $ upsc myups@mybox:1234
45 battery.charge: 100.0
46 battery.voltage: 13.9
47 battery.voltage.nominal: 13.6
48 . . .
49
50 To list the UPSes configured on this system, along with their
51 descriptions:
52
53 $ upsc -L
54 apc: Back-UPS 500
55 ppro2: Patriot Pro II
56
57 To retrieve the status for all UPSes connected to mybox, using
58 Bourne-shell syntax:
59
60 $ for UPS in `upsc -l mybox:1234`; do
61 upsc $UPS ups.status
62 done
63
65 upsc will either print a list of UPS names, a list of all supported
66 variables and their values on the UPS, or an error message. If you
67 receive an error, make sure you have specified a valid UPS on the
68 command line, that upsd(8) is really running on the other host and that
69 no firewalls are blocking you.
70
72 Earlier versions of this program used the upsfetch library and UDP
73 sockets to talk to upsd. This version of upsc uses the new upsclient
74 library, which only talks TCP. This is why upsct no longer exists.
75
77 upsd(8)
78
80 The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
81
82
83
84Network UPS Tools 09/15/2011 UPSC(8)