Koozali.org: home of the SME Server

UPS Comments please !

Graham

UPS Comments please !
« on: December 03, 2002, 02:26:49 AM »
Hi !

I wonder if anyone can comment here ?

I have purchased an APC Back-UPS CS 350 for a client.

Details here :-

Type UPS            Uninterruptable PSUs        Mfr APC
Description                           Availability        Price(exc/inc)
BackUPS 350EI 350VA         25 1-3 days                   £55.00 £64.62
Mfr code: BK350EI    Quicklinx: 11X1WS      www.dabs.com


The UPS is described in the APCUPSD manual "Apcupsd Post Installation
Configuration" as being supported and using 'simple' signaling as below


Apcupsd UPSTYPE | APC Model UPS | Signaling | Cables Supported | Status
Keyword
 
backups | BackUPS CS (serial mode) | Simple | 940-0128A | Supported


I have installed dmc-mitel-apcupsd-3.8.5-3.noarch.rpm and associated
RH daemon

My cable [940-0128A] does not appear in the drop down list nor is
described in the 'Cables' section of the documentation - although
it is shown as an example in the testing section for dumb ups ?

I set the manager for 940-0020B type cable and the system is shutdown
after a TIMEOUT which seems to work ok.

What I am not sure of is wether the UPS should come out of mains
faiure mode and stop beeping ?

If I re-apply mains I seem to get into some kind of fibrillation
mode with the UPS rapidly switching back and forth between mains
and battery. Holding the button on the front of the UPS with the
mains off seems to cure this ? Is there some kind of reset time?
The manual (piece of paper) witht the UPS doesnt describe re-starts.

Also, when the power is re-applyed the system power button needs to
be activated to boot the system back up [Isnt this just a function
of ATX PSU's anyway ?]

Another thing I have noticed is that the --killpower part of the
script didnt look like it worked although I cant trace this as I
cant find any log file where this is being recorded (it possibly isnt ?)

Any help / comments very much appreciated !


[root@server /]#
Broadcast message from root Mon Dec  2 22:58:27 2002...

Warning power loss detected with UPS UPS_IDEN

Broadcast message from root Mon Dec  2 22:58:32 2002...

Power failure on UPS UPS_IDEN. Running on batteries.

Broadcast message from root Mon Dec  2 22:59:07 2002...

Battery time limit exceded on UPS UPS_IDEN. Doing shutdown.

Broadcast message from root Mon Dec  2 22:59:07 2002...

UPS UPS_IDEN initiated Shutdown Sequence

Broadcast message from root Mon Dec  2 22:59:07 2002...

apcupsd UPS UPS_IDEN initiated shutdown
The system is going down for system halt NOW !!

Ray Mitchell

Re: UPS Comments please !
« Reply #1 on: December 03, 2002, 07:45:25 AM »
Graham

> My cable [940-0128A] does not appear in the drop down list nor is
> described in the 'Cables' section of the documentation - although
> it is shown as an example in the testing section for dumb ups ?

It is probably OK to select another "simple dumb" cable type
Check the APCUPSD manual for setup details, it gives an extensive list of compatible cable types.

> Also, when the power is re-applyed the system power button needs to
> be activated to boot the system back up [Isnt this just a function
> of ATX PSU's anyway ?]

You need to go into the servers bios to enable "boot up when AC power returns". Then the server will automatically resart without needing to push the power switch.

Regards
Ray Mitchell

Graham

Re: UPS Comments please !
« Reply #2 on: December 03, 2002, 11:52:14 AM »
Thanks for reply Ray !

I tried the simple type - it didnt shutdown properly at all - the UPS just dropped mains !! FS didnt like that at all !

I will try APC tech and see which cable numbers are equivelant to which !!

The BIOS - I havent seen that feature . . .

Will check it out though  . . .


Thanks !

Kelvin

Re: UPS Comments please !
« Reply #3 on: December 03, 2002, 12:10:42 PM »
Hi Graham,

I can share my own experience with the BackUPS series (as I have used quite a few - mostly the 650VA model).

Here are my comments (as I have experienced them myself)

1. They are 'dumb' UPSes - call it no frills if you must
2. Like you, I set the cable type to the 020B cable (closest match)
3. The killpower switch will NOT power down the UPS
4. The UPS does not know how to reboot the Server after the mains power is restored (nothing to do with the BIOS setting) because if you actually tested, you will find that the UPS continues to supply power out of the power receptacles even though the server has shut down. Therefore, the BIOS NEVER knows that power was lost and restored unless you manually turned off the UPS after the server shutdown and manually restarted the UPS again.
5. Because the UPS continues to operate after the server shutdown, it continues to beep as long as the power has not come back - yes I've had sites that totally drained the batteries this way due to an extended blackout and the staff did not bother to switch off the annoying beeping thingamajig !

However, I did not encounter the problem of the relays switching between battery and mains after reapplying power.

I have not tried the BackUPS Pro range yet (as they cost more) and for a little more than the Pro range you could get the Smart series which can make use of all the features of APCUPSD. However, APC actually have a Linux based software as well. If I ever find the opportuity to do so, I will try it to see if it gives better control over the BackUPS series than apcupsd.

Kelvin

Graham

Re: UPS Comments please !
« Reply #4 on: December 03, 2002, 03:30:21 PM »
Kelvin,

That answers most of my questions and confirms my suspicions !

I would like to test the APC Linux software - I will look at their site now !

Many Thanks Kelvin !

Graham

Re: UPS Comments please !
« Reply #5 on: December 04, 2002, 12:08:59 AM »
Hi !

Checked the APC stuff - There is a small simple signalling demon that requires compiling - from the docs it looks fairly old and as I havent got gcc etc on board
I didnt bother making it.

After that there is a full blown X - App for RH or SuSE - looks nice but obvioulsy SME doesnt have nor need X - so - think I will stick with the recommended solution.

Thanks for reading this !

Ray Mitchell

Re: UPS Comments please !
« Reply #6 on: December 04, 2002, 03:04:12 AM »
Graham

I have setup an APC Back-UPS 650  UPS (which as far as I can determine is a dumb UPS) with powstatd and it works quite good. The cable type I used was as supplied with the unit, a 940-0020C, green plug on one end grey plug on the other. I did purchase another cable which was supposedly for Linux boxes (as advised by APC tech support), a 940-0023A, but that did not work properly so it was a waste.

I did try APCUPSD with this UPS but had problems shutting it down and restarting it etc, so they do not seem compatible.

Powstatd is perhaps not as fancy as APCUPSD but it does the job OK.
It will shut down the server and UPS and restart them when power returns (as long as the BIOS startup option is set). You can delay the shut down time after mains fails and if the battery nears exhaustion it will signal the server to shutdown immediately.

Powstad may be worth trying, it does not have the nice server manager interface but is quite easy to set up, and it is configurable for different UPS's, and possibly also caters for different cables which have different signals on different pins. Read the new HOWTO mentioned below and you will understand what I mean.
I think the 350 you mentioned is similar to a 650, ie both are dumb, but it does not smooth out the mains as nicely.

The current contrib HOWTO is outdated and the old rpms it refers to only work on e-smith v4.1.2, but I have just recently put together an updated HOWTO for powstatd on v5.5. It is about to be put on the web site but is not there yet. If you want a copy I can email it to you. Please let me know.

Regards
Ray Mitchell

Graham

Re: UPS Comments please !
« Reply #7 on: December 05, 2002, 12:41:59 PM »
Thanks Ray,

I got apcupsd / server manager to work ok for just basic shutdown.

I of course would be interested in any developments for the future !

Thanks

Graham

ps I also used the other UPS outlets for :-

ISDN Telephone System and ISDN TA

It holds out on batteries for 20 mins, easily enough time to get
the admin email and for me to ring the office !!!

I amazed that people are still ploughing lots of cash into W2KServer
or Back Office SBE when SME does most of what you want !!!

Lightman

Re: UPS Comments please !
« Reply #8 on: February 23, 2003, 08:39:13 AM »
Hi Ray Mitchell.

I was reading the thread and since I have sme 5.5 and the same UPS
to setup with :) APC backup 650 , I would like to receive, if you can
and have the time, the Updated HOWTO , could you send it to me by
the mail showed here?.

Sorry to bother you, but I really need it :)

TIA (A lot !)

see you

Lightman

Ray Mitchell

Re: UPS Comments please !
« Reply #9 on: February 23, 2003, 09:21:50 AM »
Dear Lightman
The Powstatd HOWTO is at
http://www.e-smith.org/docs/howto/contrib/powstatdUPSHOWTOv5.5v5.6.txt

Regards
Ray Mitchell

Lightman

Re: UPS Comments please !
« Reply #10 on: February 23, 2003, 08:40:19 PM »
Hi Ray Mitchell

Downloaded & reading it right now.

Thanks a lot

see you

Lightman

lightman

Re: UPS Comments please !
« Reply #11 on: February 26, 2003, 01:47:22 AM »
Hi!

I downloaded the powstatdHOWTOv5_5v5_6.txt and also a cables
howto, so I can build the correct cable and configure powstatd and
have some errors, I didn't understand very good what causes it, since
I couldn't find enough documentation of how powstatd works (I will
keep looking but in the meantime maybe some of you knows about
it).

I'm runing now SME 5.5 , My UPS is APC Backup 650 the cable
was wired as follows:

RS232                                 UPS
DTR --/\/\/\/\/\/\---*
                         |
CTS -----------------*------------ 5 Low battery
GND ------------------------------4 Ground
DCD -------------------------------2 On Battery
RTS -------------------------------1 Kill UPS

So,I follow the instructions in the howto to configure the UPS and
test powstatd status, so I did:

in /sbin/e-smith
./db configuration set powstatd service \
watch ttyS0 init0 rts init1 dtr fail dcd,0 kill rts,1 low cts,0

all ok, no problems so far, then powstatd -t and....... powstatd says:

powstatd: ignoring unrecognized configuration line watch
powstatd: ignoring unreconigzed configuration line fail
powstatd: ignoring unrecognized configuration line low

powstatd: no UPS to watch; quitting.

:(

serial port is COM1 , tested with a mouse and serial terminal
so I'm sure about that, is not the wrong one.

I'm lost.

any ideas?.
my SME is configured as server only .

TIA !

see you

Lightman

lightman

Re: UPS Comments please !
« Reply #12 on: February 26, 2003, 02:52:34 AM »
Hi, It's me again :)
I reply to myself, the errors commented before was due to
a incomplete /etc/powstatd.conf

so I use the template in /usr/share/doc/powstatd-1.4.1/
to create one that reflects my current cable settings, those where

watch ttyS0
init rts 0   (Because it was 1 by default and turn off my UPS :-) )
kill rts 1
init dtr 1
fail dcd 1
low cts 0

then replace the /etc/powstatd.conf by this one and then powstatd -t
and I'm testing the signals right now while I'm typing this post, fail
signal it's OK, now waiting for LOW BATT signal, since the UPS is
650 and I have a PII CPU with no HD just as dummy load, it would
take a while to get the LOW batt I think :-)

now, Did I do something wrong editing /etc/powstatd.conf ?, since
it says that I shouldn't touch it, instead edit the templates, but
the templates didn't allow me to test powstatd -t

should I do the "db configuration set powstatd service...." stuff
anyway??.

thanks in advance

see you

Lightman

brian kirk

Re: UPS Comments please !
« Reply #13 on: February 26, 2003, 02:57:29 AM »
Hi Lightman - I too am wrestling with this. I had to add a conf file /etc/powstatd.conf to get powstatd -t to work. Also some useful stuff here http://www.apcupsd.com/manual/apctest.html. Let me know if you get it working.
Regards
Brian

Ray Mitchell

Re: UPS Comments please !
« Reply #14 on: February 26, 2003, 04:10:30 AM »
I think you need to read the HOWTO again and follow the directions carefully.

From the HOWTO the "stuff"
/sbin/e-smith/db configuration set powstatd service \
watch ttyS0 init0 rts init1 dtr fail dsr,0 kill rts,1 low cts,0
/sbin/e-smith/signal-event console-save

is what you do at the beginning and this should create a suitable powstatd.conf. If the values are not correct for your particular UPS, this will become apparent during testing, and you can then make changes as required.

To quote "If it is (ie your UPS is listed) you're in luck and can run the command in the README as configured to modify the e-smith database for your UPS configuration - if it's
not use a config that is close for testing."

If changes are needed then you redo the "stuff"
To quote "You would update the config:
/sbin/e-smith/db configuration set powstatd service \
watch ttyS0 init0 rts init1 dtr fail dcd,0 kill rts,1 low cts,0
with the obviously different values you determined during testing.

Please also note the omission of one command in the section towards the end of the HOWTO which enables powstatd at startup (this is nothing to do with your problems re powstatd.conf).

then do

/sbin/e-smith/db configuration setprop powstatd status enabled
/sbin/e-smith/signal-event console-save
/etc/rc.d/init.d/powstatd start

shutdown and connect your e-smith box to the UPS and reboot.
That's it.


Hope this helps
Regards
Ray Mitchell

Ray Mitchell

Re: UPS Comments please !
« Reply #15 on: February 26, 2003, 04:22:26 AM »
Here is a revised version of the HOWTO, with minor corrections.
To be posted to the Contrib HOWTO site asap.
Regards
Ray Mitchell

HOWTO install and configure powstatd on mitel sme v5.5 & 5.6:
Revised: 26 February 2003


Note: The contents of this document are based on the readme by Charlie Brady who wrote the contrib, & on the powstatd man file.
The revised document (released 18 November 2002) is copied from the original by Graeme Robinson and modified as required to include the new updated rpms, installation instructions to suit the revised rpms and other minor additions.
This latest revision (26 February 2003) includes the db configuration command to enable powstatd at start up, and additional information about cables from the apcupsd reference manual and minor spelling corrections

This revised procedure has been tested on a mitel sme server v5.5 with update 2, and on a v5.6 unsupported developer release.

This document is intended for an audience wanting to install and configure a UPS on a mitel sme server, probably for the first time.

Preparation:
-=-=-=-=-=-

- You need a smart UPS or a UPS with some kind of serial connection for this document to make sense. Note that some UPS's will only signal battery failure, not the LOW state - unless the documentation for your UPS tells you this (I'm yet to see it) you can only test this by running the UPS battery down under test conditions.

- You will also need a serial cable for your system, which is often a purchaseable addon component for many UPSs.

- information about cables and pin connections can be found in the Cables section of the APCUPSD Reference Manual, see http://www.apcupsd.com/index.html
and http://www.apcupsd.com/manual/cables.html

- the UPS needs to be fully charged

- install your UPS physically but connect it to a lamp or your monitor, not your sme box.

Install the software:
-=-=-=-=-=-=-=-=-=-=-

Install as root or using sudo:

rpm -Uvh ftp://ftp.e-smith.org/pub/e-smith/contrib/CharlieBrady/RPMS/i386-RH7.0/ powstatd-1.4.1-1.i386.rpm

then

rpm -Uvh ftp://ftp.e-smith.org/pub/e-smith/contrib/CharlieBrady/RPMS/noarch/
e-smith-powstatd-0.1.0-01.noarch.rpm

Alternatively download the rpms to an empty folder and do

rpm -Uvh *.rpm

Note: If you have already downloaded an earlier version of the powstatd-1.4.1-1.i386.rpm (pre 11 November 2002), ensure you download the latest version as it has been recompiled to run with more recent versions of the rpm command.

Note: If you are updating from an earlier version of e-smith 4.1.2 or sme 5.1.2 server and updating a previous installation of powstatd, then the installation of the new e-smith-powstatd rpm will convert the configuration db setting from UPS to powstatd in the /home/e-smith/configuration file.

If necessary you may need to do
rpm -Uvh --force e-smith-powstatd-0.1.0-01.noarch.rpm
and this will automatically convert the db entry

Configuring powstatd:
-=-=-=-=-=-=-=-=-=-=-

Now review
/usr/share/doc/e-smith-powstatd-0.1/README
to see if your UPS is listed.

If it is you're in luck and can run the command in the README as configured to modify the e=smith database for your UPS configuration - if it's
not use a config that is close for testing. eg

/sbin/e-smith/db configuration set powstatd service \
watch ttyS0 init0 rts init1 dtr fail dsr,0 kill rts,1 low cts,0

note: get your com port right (com1=ttyS0, com2=ttyS1)

to activate this config do

/sbin/e-smith/signal-event console-save

Now run a test:

powstatd -t

If your config is right it will report OK with power to the UPS connected, then change state to FAIL within 10-30secs after you
remove mains power from the UPS, then switch to LOW when the battery has run down.
eg:
CTS DSR DCD RNG   DTR RTS   STATUS
 1   0   1   0     1   0    OK
 1   0   1   0     1   0    OK


NB: using powstatd -t won't cause your system to shutdown - it's test mode.
To cancel test mode press Ctrl c

If your config is wrong then the initial power-on state will report FAIL or LOW.  No problem - we can now modify the config and test again.

Modifying a config correctly:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

If your system reports FAIL or LOW instead of OK with full mains power to the UPS do these things in this order:

1. make sure you have the correct com port selected and that all cables really are connected!

2. look again at your test output.  The first 4 columns refer to input coming from the UPS - the will be either zero's or one's.
If they are all zero's and you are sure of 1. then the cable you are using is the wrong one & won't work with powstatd. See your
supplier and get another that's compatible (what this means is beyond the scope of this doc).

3. If there is some input signal coming in (ie one or more of the CTS, DSR, CDC, RNG are signalling '1') in test mode,
make a note of the state change from power on to power off and then battery low.  This last change may take some time as running the power
down on a big UPS without significant load can take a while - don't overload it though as the UPS will just shutoff.

You can then modify the configuration command appropriately
eg. (the columns may not line up too well)

For:
CTS DSR DCD RNG   DTR RTS   STATUS
 1   0   1   0     1   0    OK    = full mains power
 1   0   0   0     1   0    FAIL  = battery power, |fail|dcd,0|
 0   0   0   0     1   0    LOW   = low battery power, |low|cts,0|

You would update the config:
/sbin/e-smith/db configuration set powstatd service \
watch ttyS0 init0 rts init1 dtr fail dcd,0 kill rts,1 low cts,0
/sbin/e-smith/signal-event console-save

now do powstatd -t again and test state changes by removing power.

Time to go live! (But still not with the server connected!)

/etc/rc.d/init.d/powstatd start

Try removing power from the UPS - you should get an onscreen announcement that power has failed and shutdown will happen in x minutes.
Reconnect the power and you should get a message saying power has been restored and shutdown cancelled.

If you wish to alter the default time before the UPS shuts down after power has failed, you will need to create a custom template. The default time is 2 minutes.

Do
mkdir -p /etc/e-smith/templates-custom/etc/inittab

then do
cp -rp /etc/e-smith/templates/etc/inittab/40powerfail /etc/e-smith/templates-
custom/etc/inittab/

then do
pico /etc/e-smith/templates-custom/etc/inittab/40powerfail

then change the part that says
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

(change the +2 to say +7 if you want the UPS to wait 7 minutes before shutting down after power has failed)


When you are happy with your settings and ready to set powstatd and your UPS working on a live server
then do

/sbin/e-smith/db configuration setprop powstatd status enabled
/sbin/e-smith/signal-event console-save
/etc/rc.d/init.d/powstatd start

shutdown and connect your sme box to the UPS and reboot.
That's it.

Note: the kill command is almost always signalled by RTS 1 so the init state should always be '0', but if you find your UPS shutting down when you first run powstatd in real mode try changing this to '1' and kill to 0.  

Another problem you might get if you get the config wrong is the phenomenon of your server shutting down just after it's started up. Try quickly logging in and doing a
shutdown -c
to cancel the shutdown and allow you to modify the config.

If you cannot do this, then try rebooting in single user mode and disable powstatd by renaming /etc/powstatd.conf to something else. Reboot and you should be able to fix the configuration.
To do this press Ctrl X when you see the Mitel logo appear on the screen after a reboot. This will start the server at a lilo text prompt.
Type:
esmith single
or
esmith 1

This boots the server into single user mode.
Then do
mv /etc/powstatd.conf /etc/powstatd.conf.old

then reboot (press Ctrl Alt Del) and redo the configuration setup with the new (correct) configuration parameters.

Ray Mitchell
26 February 2003
mitchellcpa@yahoo.com.au

Ray Mitchell

Re: UPS Comments please !
« Reply #16 on: February 26, 2003, 04:41:21 AM »
For further information about powstatd
at a command prompt do
man powstatd
press q to quit the manual pages
(this assumes you have the man rpm installed)

Regards
Ray Mitchell

lightman

Re: UPS Comments please !
« Reply #17 on: February 26, 2003, 04:54:23 AM »
Hi Ray Mitchell

Thanks a lot for your help, I did exactly as you said and works perfectly

When I first started doing this I did enter the command in the format
explained in your howto, however it gives me the 4 errors commented
earlier.
after modify the /etc/powstatd.conf,  that command worked alright,
perhaps it was something I did in between, and I don't remember.

I tested both situations 2 minute shutdown and inmediate shutdown when
battery is low, both works excellent!

Now only left to convince the other server to shutdown via UDP,
(i have 2 separate boxes, 1 is fileserver the other is internet gateway)
I hope that works :), if not I'll make a Y UPS cable :-) (no kill signal
in one place obviously).

thanks again for take the time to answer me, you helped me a lot.

new HOWTO was saved for future reference :)

see you

LIghtman

brian kirk

Re: UPS Comments please !
« Reply #18 on: February 26, 2003, 05:18:28 AM »
hmm -Charlie's e-smith-powstatd-0.1-03 gave me an incorrect conf file with just watch, fail and low in it, same as lightman had. Reverting to ver 0.1.0-01 gives a correct conf file and powstatd -t is now happy. Bigger is obviously not better. Thanks Ray
Regards
Brian

Ray Mitchell

Re: UPS Comments please !
« Reply #19 on: February 26, 2003, 09:43:05 AM »
brian kirk wrote:
> hmm -Charlie's e-smith-powstatd-0.1-03 gave me an incorrect

There is a new rpm
e-smith-powstatd-0.1.0-04.noarch.rpm
at Charlies site
Regards
Ray Mitchell