*BSD News Article 43334


Return to BSD News archive

Xref: sserve comp.unix.admin:27084 comp.unix.questions:61964 comp.unix.bsd:16348
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!agate!news.mindlink.net!vanbc.wimsey.com!vanbc.wimsey.com!not-for-mail
From: sl@vanbc.wimsey.com (Stuart Lynne)
Newsgroups: comp.unix.admin,comp.unix.questions,comp.unix.bsd,
Subject: Re: Monitoring UPS
Date: 11 Mar 1995 20:04:30 -0800
Organization: Wimsey Information Services
Lines: 148
Message-ID: <3jtrse$eb1@vanbc.wimsey.com>
References: <3jtqbl$mor@sleipnir.iaccess.com.au>
NNTP-Posting-Host: vanbc.wimsey.com

In article <3jtqbl$mor@sleipnir.iaccess.com.au>,
Phillip Krokidis <phil@iaccess.com.au> wrote:
>Does anyone know of any software to run on a BSD4.3 system
>to monitor a UPS. I have seen software for other systems but none
>yet for BSD. 

It really depends on the type of UPS etc. But I have a driver and some
scripts ... the driver monitors the UPS via a dedicated, hardwired serial
port. IBM sio variety. I.e. it replaces the serial driver for that serial
port. Which is good in that we can get the control we want, but is bad in
that it is less portable.

Anyhow, originally written for SCO UNIX. Wouldn't be terribly to port if
someone was so inclined...

So if there is enough interest I would be happy to shar it up and post.
Email might be best. I don't always get in here before stuff expires.

----- README.UPS -----

UPS Wiring 							Stuart Lynne
Wimsey Information Technologies			Thu Dec 02 14:26:08 PST 1993

The Wimsey UPS monitoring software is used to detect power failures and shut
the system down.

It is composed of a device driver, program and script:

  /etc/conf/pack.d/ups
  /etc/powerfail
  /etc/upsquery

The UPS device driver monitors the UPS via a built in serial port. If it
detects that the power is out while the system is booting it will attempt to
tell the UPS to power off. Failing that it will prevent the system from
continuing to boot until the power is on again. Once up it monitors the
power for three different states. Power ok, power fail and battery low. Each
time the state changes it sends SIGPWR to init which will then run whatever
program is specified in the inittab file for the powerfail action.

The powerfail script is usually called by init on receipt of SIGPWR. It can 
be customized to send messages to users about power status and shut the
system down as needed.

The upsquery program will return the current power status: POWEROK,
POWERFAIL and LOWBATTERY.


Signalling Model
****************

We assume the following signals are available on the UPS wiring cable
 
 	7	GND
 	20	DTR	We will raise this to enable checking
 	4	RTS	We will raise to turn power off
 	8	DCD	We will check this for power off
 	5	CTS	We will check this for low battery
 
 
  States
 			DTR	RTS	DCD
 
 
 	Power OK	high	low	low	
 	Power off	high	low	high	
 	Battery low	high	low	high	
 
 	Turn off	high	high	high	


/etc/inittab
************

Add the following line:

  pwrf:234:powerfail:/etc/powerfail > /dev/console 2>&1


Wiring
******

The basic model for the wiring is:

    Power On
	pull to ground 20(DTR)-8(DCD)-6(DSR), keeping DCD,DSR low

    Power Fail
	allow 20(DTR) to pull 8(DCD) and 6(DSR) high, 

    Power Fail & Low Battery
	ground 2(Tx)-3(Rx), preventing loopback of data.


Tripplite BC*LAN
****************

    pin 1	Common/Negative
    pin 2	External inverter shutdown
    pin 3	Line fail open / Inverter OFF (AC linepower present)
    pin 4	Return / External inverter shutdown / Negative side
    pin 5	Line fail close / Inverter ON (AC line power failure)
    pin 6 	Low battery / Positive Side of 2 minute warning circuit


	UPS	DB25

	1	7		Common Negative/Gnd
	3	20,8,6		Power OK , positive
	6	2,3		Battery Low, ground

	2	4		External shutdown, positive side
	4	7		External shutdown, negative side


American Power Corp.
********************


    pin 1	Turn off UPS output until power restored
    pin 2	UPS pulses with high RS232 signal on powerfail and restore
    pin 3	short to pin 4 when powerfail
    pin 4	ground
    pin 5	short to pin 4 when low battery
    pin 6	short to pin 4 when power ok
    pin 7	Turn on UPS 
    pin 8	+24VDC
    pin 9 	chassis gnd


	UPS	DB25
	1	4 		Shutdown
	4	7		Ground
	5	2,3		Battery low, gnd
	6	20,8,6		Power OK, gnd

   
APC Smart Cable

   	DB9	DB9	DB25
     
	2	2	3
	1	3	2
	9	5	7


-- 
Stuart Lynne <sl@wimsey.com>      604-933-1000      <http://www.wimsey.com>