Jump to content

Clean powerdown interface to APC


Recommended Posts

I have an APC rackmount SmartUPS 1000 that is powering both my unraid server and a ubuntu 10.04 server.

 

I would like to get the unMENU Clean Powerdown addon working. Here is my dilemma....

 

My SmartUPS1000 only has a serial port and a slot for the network add-on. My unRAID motherboard doesn't have a serial port... just USB and LPT (built the server out of parts laying around in old boxes, and threw into an old 4u cheap rackmount case). My Ubuntu server is a real 1u server and has a serial port, LTP, USB etc....

 

Any suggestions on getting them both powering down cleanly off of the APC status? I'm happy to buy the network module for the APC but does that clean powerdown add-on have any idea how to read the APC status via the network?

 

Having the unRAID server power down cleanly is more important than the Ubuntu server.

So if I can't get unRAID to read the APC network module, would the powerdown add-on work with a USB->Serial or LPT->Serial cable?

 

Or am I better off just looking for a MB / CPU combo? The current unRAID system is running off an old Intel P4 3GHz...but unRAID isn't exactly CPU intensive so it's chugging along fine.  

Link to comment

You sure you do not have a serial port on your Unraid motherboard as I have not seen a motherboard without a serial port (they may not be on the back panel but there is a COM header somewhere) and if you use something like this - http://www.newegg.com/Product/Product.aspx?Item=N82E16812196457&cm_re=serial_port_bracket-_-12-196-457-_-Product

you can have your serial port

 

Good point... didn't event think to check for MB header. It's an old ASRock P4Dual-915GL... looks like it has a com header. I'm betting one of my boxes of spare parts probably even has a serial to header to back pannel bracket. I'll look tonight.

 

Any ideas on getting the Ubuntu server shutting down as well?

Link to comment

Any ideas on getting the Ubuntu server shutting down as well?

apcupsd already broadcasts the UPS status on the LAN.

All you need do is also install apcupsd on the ubuntu box and set it to listen to the LAN.

 

Sweet! Thanks I'll play around tonight and let you know how it goes.

Link to comment
Any ideas on getting the Ubuntu server shutting down as well?

 

When you crack that one, please let me know how!  I can see all the ups status and graphs on my ubuntu desktop, but I cannot find the way to get it to shutdown!

Link to comment

Any ideas on getting the Ubuntu server shutting down as well?

 

When you crack that one, please let me know how!  I can see all the ups status and graphs on my ubuntu desktop, but I cannot find the way to get it to shutdown!

 

I was just reading through this post:

http://linux.derkeiler.com/Mailing-Lists/SuSE/2008-12/msg00048.html

We'll see tonight if that's of any help.... Can't play around too much until I make it home and get the serial cable connected to the UPS.

Link to comment

Well I found a serial header bracket in my box of parts... evidentially at some point there was a great purge of all things LPT and serial in my cable box though.... all I found was a million VGA cables. :( Wonder if radio shack still sells stuff like that? I guess I'll go see.

Link to comment

Well, radioshack didn't have a serial cable all they had was a usb -> serial cable and they wanted to charge $40 for it!!!!!!!

 

I ended up buying a couple of 9pin ends and ripping apart a vga cable and turning it into a 9pin serial.... but allas my wiring skills evidentially suck, because as soon as I plug it into the APC and any of the servers the APC shuts off and refuses to start until I unplug the serial cable.

 

Have to order a new cable form amazon and will tackle this in a couple days, once it shows up.

Link to comment

Well, radioshack didn't have a serial cable all they had was a usb -> serial cable and they wanted to charge $40 for it!!!!!!!

 

I ended up buying a couple of 9pin ends and ripping apart a vga cable and turning it into a 9pin serial.... but allas my wiring skills evidentially suck, because as soon as I plug it into the APC and any of the servers the APC shuts off and refuses to start until I unplug the serial cable.

 

Have to order a new cable form amazon and will tackle this in a couple days, once it shows up.

 

Hi nikbrown,

 

Did you happen to check out the link I posted? You should be able to use the serial->usb cable without having to resort to ordering anything else... Unless I'm missing something....

Link to comment

I dont have a serial->usb cable... radio shack wanted to charge $40 for it! Amazon should be delivering a serial cable today.

 

Ahhh. Understood! I received the usb -> serial cable when I bought the UPS, and assumed you had one as well. :)

Link to comment

Ahhh. Understood! I received the usb -> serial cable when I bought the UPS, and assumed you had one as well. :)

 

All my UPS's came to me not new. I bought "dead" UPS's that just needed new batteries :-D and the rack-mount one was from a business that isn't around anymore....  and consequentially no cables....

 

Never really bothered with status cable much.... mostly just used UPS's to prevent brownouts and blips from the grid.... but now with unRAID a not clean shutdown matters more.

Link to comment

Excuse the ignorance of a novice, but just what does unRaid do if the power suddenly stops to the box. I would have thought that the data on the drives would remain intact, unless of course a write happened to be occurring at that instant.

Link to comment

Excuse the ignorance of a novice, but just what does unRaid do if the power suddenly stops to the box. I would have thought that the data on the drives would remain intact, unless of course a write happened to be occurring at that instant.

 

It does for the most part, though stuff does happen.  On powering back up a parity check will start.  The reiser fs will probably have to replay any journaled transactions and that can cause the drives to take forever to mount.

Link to comment

Excuse the ignorance of a novice, but just what does unRaid do if the power suddenly stops to the box. I would have thought that the data on the drives would remain intact, unless of course a write happened to be occurring at that instant.

 

It does for the most part, though stuff does happen.  On powering back up a parity check will start.  The reiser fs will probably have to replay any journaled transactions and that can cause the drives to take forever to mount.

 

Ok thanks for that

Link to comment
  • 2 weeks later...

We'll I finally got an official APC serial cable. (stupid proprietary cables!!!!!!) If you plug a regular serial cable into an APC it automatically shuts off

 

Anyway I got apcupsd working on the unraid server and it shuts the computer down after about 5 min of no power.

 

I also got my Ubuntu server listening to the apcupsd on the unraid server so they both shut down and then the UPS turns off! success!!!!

 

I'm attaching my apcupsd.conf file from my ubuntu server in case anyone wants to see it.

Possibly pertinent info:

My Unraid server is on ip: 10.0.0.11

My Ubuntu server is on: 10.0.0.5

 

I basically just followed tips form this post for my ubnutu box:

http://linux.derkeiler.com/Mailing-Lists/SuSE/2008-12/msg00048.html

apcupsd on ubuntu just listens for the UPS status on:

UPSTYPE net

DEVICE 10.0.0.11:3551

 

and configured my unraid server to use the serial port for apcupsd within unmenu.

apcupsd.conf

Link to comment
Anyway I got apcupsd working on the unraid server and it shuts the computer down after about 5 min of no power.

 

I've had this working ever since the day I took delivery of my Back-UPS 650.

 

I also got my Ubuntu server listening to the apcupsd on the unraid server so they both shut down and then the UPS turns off! success!!!!

 

This is the bit which I've never got working before, even though I was able to use gapcmon on the ubuntu box to report all of the UPS parameters.  However, I think that I now have it sorted.  I think that the trick I was missing was that the file /etc/default/apcupsd on my ubuntu box had to be changed : the line 'ISCONFIGURED=no' had to be changed to 'ISCONFIGURED=yes'.

 

Not wanting to power down my unRAID server unnecessarily, I configured a short TIMEOUT value in the conf file on ubuntu, and pulled the power from the UPS.  Success!  The ubuntu box shutdown tidily and I restored power to the UPS before unRAID reacted.

 

The other thing I would say is that I think that it is important that the power fail parameters should be set more aggressively on the slave computer (ie my ubuntu box) than on the master (ie my unRAID box).  In other words, BATTERYLEVEL and MINUTES should both have higher values than on the master.  Also, if you use it, TIMEOUT should be a smaller number on the slave than on the master.  Otherwise, with a poll interval of 60 seconds, it is possible that the UPS shuts down before the slave reaches its thresholds (up to 60 seconds later).  If I'm wrong on this, and there is more intelligence built into apcupsd to cope with the situation, then I'll be happy to be told so.

 

One thing I still don't have working, although it's completely unimportant, is that I can't get apctest to work on the ubuntu box:

 

peter@desktop:~$ sudo apctest


2011-05-19 19:02:55 apctest 3.14.8 (16 January 2010) debian
Checking configuration ...
Attached to driver: net
sharenet.type = DISABLE
cable.type = CUSTOM_SMART

You are using a SMART cable type, so I'm entering SMART test mode
mode.type = NETWORK_UPS
Setting up the port ...
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing Smart UPSes.
Please select the function you want to perform.

1) Query the UPS for all known values
2) Perform a Battery Runtime Calibration
3) Abort Battery Calibration
4) Monitor Battery Calibration progress
5) Program EEPROM
6) Enter TTY mode communicating with UPS
Q) Quit

Select function number: 1

I am going to run through the series of queries of the UPS
that are used in initializing apcupsd.

Simulating UPSlinkCheck ...
YWrote: Y Got: 
getline failed. Apparently the link is not up.
Giving up.

 

apctest believes that 'the link' is not up - I presume that this refers to the net link between slave and master, but it clearly is working.  I'm not sure why apctest has this problem.

 

Hmmm .. perhaps apctest is only supposed to work on a master machine, not via 'net' connection and/or it really is only for SmartUPS, not BackUPS models?

Link to comment

 

The other thing I would say is that I think that it is important that the power fail parameters should be set more aggressively on the slave computer (ie my ubuntu box) than on the master (ie my unRAID box).  In other words, BATTERYLEVEL and MINUTES should both have higher values than on the master.  Also, if you use it, TIMEOUT should be a smaller number on the slave than on the master.  Otherwise, with a poll interval of 60 seconds, it is possible that the UPS shuts down before the slave reaches its thresholds (up to 60 seconds later).  If I'm wrong on this, and there is more intelligence built into apcupsd to cope with the situation, then I'll be happy to be told so.

 

I fully agree with you that this is a MUST DO.

also, don't forget to plug in any networking devices (switches/hubs/routers/power over Ethernet plugs) needed for the master and the  slaves to talk to each other into the UPS's battery outlets.

 

As far as i can tell, You are correct. apcupsd does broadcast "Hey I'm shutting down.. NOW!"

And as far as I can tell, It does not broadcast "I'm shutting down NOW, All my Slaves should also.."

 

If it did, life would be easier. I have my Win server slave shut down about 4 minutes before my unRAID shuts down. I don't want to take the chance of my windows server missing the timeout because the master (unRAID) already powered off and stopped broadcasting UPS/POWER status.

 

In addition, if you have unRAID set to power off the UPS, if the  slave has not shut down.. eek.. that's just as bad as pulling the plug on a live server.

 

Someone said there was a way to shut down a slave if the master status "stopped". I didn't see how to do that and I don't want to (so i didn't look to see how).

I'd hate for my Windows box to shut down because i powered off the unRAID.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...