File: README

package info (click to toggle)
upsd 2.5-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 216 kB
  • ctags: 114
  • sloc: ansic: 1,037; sh: 332; makefile: 104
file content (197 lines) | stat: -rw-r--r-- 8,879 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

                         INSTALL file for UPSD

                      26 Nov 1996, Bob Hauck
                      Wasatch Communications Group
                      http://www.wasatch.com/~bobh

                      9 June, 2000, Michael Robinton
                      BizSystems, Michael@bzs.org

                      3 Nov, 1999, Russell Magee
                      Mount Royal College, rmagee@mtroyal.ab.ca

INTRODUCTION

Upsd is a UPS monitor program.  It supports both local monitoring of a
UPS that is directly connected to the computer's serial port and remote
monitoring over a network.  Remote monitoring is done by polling the
master upsd (the one with the direct serial connection to the UPS).
There are a number of options to control the poll interval and the delay
before shutdown.

Upsd can be run in a "one-shot" mode to detect the UPS status from
a script.  Upsd writes it's log messages using the syslog facility,
which usually puts them into /var/log/messages.

Upsd can also be run in "wait" mode from a script with the filesystem 
dismounted to facilitate power recovery in situations where the UPS
can not be turned off, the host is a "slave" or the file system(s) are
software raid and must be dismounted to prevent damage.

Upsd was developed on a Linux system running the Caldera 1.0 release.
It has been tested on the Slackware 3.6 release w/wo raid 5 and the 
2.0.33 thru 2.0.36 kernels. It has also been checked on older kernels 
2.0.31 and 1.2.13 with sysvinit 2.57b.

INSTALLATION

Just edit /etc/init.d/ups to fit your puposes.

To modify the upsd script for a slave system, change the upsd
startup command line to something like "upsd -c0 -s host", where "host"
is the name or IP address of the master system.

You will also need to add power fail and power ok entries to your
existing /etc/inittab, like this:


# When our UPS tells us power has failed, assume we have a few minutes
# of power left.  Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have upsd installed and your
# UPS connected and working correctly.  

pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"

SCRIPT: upsdummy

is a upsd control utility for use with upsd operating in 'Dummy' mode.
As a master, the script simply provides a simulated UPS status to
the daemon which in turn serves it to network clients. All other 
upsd operations are inhibited. As a slave, the upsd daemon operates 
normally in every respect except that the status information is
provided by upsdummy rather then the actual UPS or slave network
connection. 'upsdummy' has settable parameters.

MAKING A CABLE

The master copy of upsd expects to be connected to a UPS via a serial
port.  The control lines on the serial port are used to monitor the
status relays in the UPS.  Upsd does not use the "smart" mode of UPS's
like the APC SmartUPS for two reasons.  First, there are no standards
for the smart mode commands.  And second, the manufacturer of the most
popular models of smart UPS, APC, refuses to release programming
information except under a restrictive NDA that effectively prohibits
releasing source code.

To use the "dumb" mode of your UPS, a simple cable can be made according
to the following diagram:

   DB9 SER DB25                                       UPS

   (1) DCD (8)  <---------------------+---------------O
                                      |                / PWR FAIL
   (6) DSR (6)  <-------+-----XXXXXX--+               O
                        |                             +-------+
                        |  10K Ohm, 1/4 Watt          O       |
                        |                      LO BAT  \      |
   (4) DTR (20) >-------+-----XXXXXX--+               O       |
                                      |               |       |
   (8) CTS (5)  <---------------------+---------------+       |
                                                              |
   (5) GND (7)  >---------------------------------------------+
                                                              |
                                                              x
                                                              x
                                                              x
                   1N4001, 1N4740 or equiv        SHUTDOWN    |
   (7) RTS (4)  >------------>|-----------------------+---->|-+~


The diode in the RTS line protects the led in the UPS from excessive 
backward voltage. The diode is a standard 1 watt power rectifier type 
of diode. The cable will work without the  diode, however, it is 
present in many UPS manufacturer's cables.


Some UPS's (like Tripp Lite) separate the GND and SHUTDOWN return lines in
which case your cable should either tie those lines together or 
be made according to this diagram (preferred).

   DB9 SER DB25                                       UPS

   (1) DCD (8)  <---------------------+---------------O
                                      |                / PWR FAIL
   (6) DSR (6)  <-------+-----XXXXXX--+               O
                        |                             +-------+
                        |  10K Ohm, 1/4 Watt          O       |
                        |                      LO BAT  \      |
   (4) DTR (20) >-------+-----XXXXXX--+               O       |
                                      |               |       |
   (8) CTS (5)  <---------------------+---------------+       |
                                                              |
   (3) TD  (2)  >---------------------------------------------+

   (7) RTS (4)  >------------>|-----------------------+---->|-+~
                   1N4001, 1N4740 or equiv        SHUTDOWN    |
                                                              x
                                                              x
                                                              x
                                                              |
   (5) GND (7)  >---------------------------------------------+


The pinouts for the APC SmartUPS v/s and the Tripp Lite LAN 2.1 series
are shown below in the table below.

   Signal   9-pin   25-pin     APC SmartUPS v/s   Trip Lite (Lan 2.1)
   ======================================================================
   DCD        1        8        3 (PWR FAIL)            5 (PWR FAIL)
   DSR        6        6        NC			NC
   DTR        4       20        NC                      NC
   CTS        8        5        5 (LOW BAT)             2 (LOW BAT)
   TD         3        2        NC                      1 (COMMON PF, LB)
   RTS        7        4        1 (RXD or SHUTDOWN)     2 (SHUTDOWN POS)
   GND        5        7        4 (GND)                 4 (GND -SHUTDOWN)
 
Belkin ReSource F5C520c UPS
===========================

This UPS comes with what looks like a standard DB-9 M-F serial cable but
it is wired differently. There appear to be no internal resistors (the
UPS may have an internal circuit with the pullup resistors for the status
lines). The pinout appears to be as follows:

    DB-9 (PC side, female)               DB-9 (UPS side, male)
    ----------------------               ---------------------
    Pin                                  Pin     Meaning
    ---                                  ---     ------
    1   (DCD) <--------------------------- 1     LOW BATTERY
    3   (Tx)  ---------------------------> 5     ?? (PC's Tx tied to GND?)
    4   (DTR) ---------------------------> 4     UPS Shutoff (when on battery)
    7   (RTS) ---------------------------> 7     Power to UPS status lines
    8   (CTS) <--------------------------- 8     ACFAIL

If you have some other model of UPS, you will need to consult your UPS
manuals for the pin numbers on the UPS end.  Note that this diagram
assumes that the UPS relays CLOSE when the LO BAT or PWR FAIL conditions
become true and are OPEN otherwise.  If your UPS does not support the LO
BAT or SHUTDOWN signals, then you can omit those connections and upsd
will still work (without support of those features of course).

The SHUTDOWN signal is expected to be active high.  Upsd will drive RTS
high for at least 5 seconds when a shutdown is requested.  Note that
most UPS's will not honor this if utility power is present.


OBTAINING UPSD

The master ftp site is <ftp://ftp.wasatch.com/pub/users/bobh/Linux>.
Upsd is distributed as a gzipped tar file named "upsd-x.y.tgz", where
x.y is the revision level.


COPYING

Upsd is covered by the GNU General Public License.  See the "COPYING"
file for details.


BUG REPORTS

Please mail any questions or comments to the author, Bob Hauck.  The
email address is:  bobh@wasatch.com. Upgrade to 2.x by Michael Robinton,
michael@bizsystems.com.