Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
multiple instances of apcupsd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
gr0x0rd
Guru
Guru


Joined: 12 Aug 2006
Posts: 311

PostPosted: Sat May 29, 2010 7:33 pm    Post subject: multiple instances of apcupsd Reply with quote

I'm currently working on a UPS management project in order to shut down all our servers gracefully in the case of a power failure. I've got apcupsd happily installed and configured on the gentoo network management server and connected to a standalone UPS via USB so it will be the last server standing and can delegate to the others.

The remaining UPSes have smart cards installed and are connected via ethernet, so the next step is to set them up with additional instances of apcupsd over snmp. Portage tells me
Code:
 * Since version 3.14.0 you can use multiple apcupsd instances to
 * control more than one UPS in a single box.
 * To do this, create a link between /etc/init.d/apcupsd to a new
 * /etc/init.d/apcupsd.something, and it will then load the
 * configuration file at /etc/apcupsd/something.conf.
Great! So I
Code:
 ln -s /etc/init.d/apcupsd /etc/init.d/apcupsd.UPS03
and create a new conf file, /etc/apcupsd/UPS03.conf. However,
Code:
/etc/init.d/apcupsd restart
still only restarts the original instance. I can easily run the second instance using
Code:
/usr/sbin/apcupsd -f /etc/apcupsd/UPS03.conf
, so I could add this to startup manually, but I'd like to do it more elegantly (the gentoo way!) if possible. I've also tried changing the conf file to /etc/apcupsd/apcupsd.UPS03.conf, saw that after googling, but I suppose that will depend on what the devs have set up in the init script.

Is this a bug or am I missing something here?

Thanks,
_________________
~g
emerge -FML...
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23082

PostPosted: Sat May 29, 2010 8:56 pm    Post subject: Re: multiple instances of apcupsd Reply with quote

gr0x0rd wrote:
The remaining UPSes have smart cards installed and are connected via ethernet, so the next step is to set them up with additional instances of apcupsd over snmp.
Why not have the single instance on the main Gentoo system control the slave instances? There seems to be no need to polyinstantiate apcupsd on any single system for your situation.
gr0x0rd wrote:
Code:
 * Since version 3.14.0 you can use multiple apcupsd instances to
 * control more than one UPS in a single box.
 * To do this, create a link between /etc/init.d/apcupsd to a new
 * /etc/init.d/apcupsd.something, and it will then load the
 * configuration file at /etc/apcupsd/something.conf.
Great! So I
Code:
 ln -s /etc/init.d/apcupsd /etc/init.d/apcupsd.UPS03
and create a new conf file, /etc/apcupsd/UPS03.conf. However,
Code:
/etc/init.d/apcupsd restart
still only restarts the original instance. I can easily run the second instance using
Code:
/usr/sbin/apcupsd -f /etc/apcupsd/UPS03.conf
, so I could add this to startup manually, but I'd like to do it more elegantly (the gentoo way!) if possible. I've also tried changing the conf file to /etc/apcupsd/apcupsd.UPS03.conf, saw that after googling, but I suppose that will depend on what the devs have set up in the init script.

Is this a bug or am I missing something here?
You are missing something. Each instance of apcupsd created in this way is intended to be wholly independent, so restarting the original apcupsd is not supposed to affect any of the other instances. If you want to restart one of the secondary instances, use its init script directly: /etc/init.d/apcupsd.UPS03 restart.
Back to top
View user's profile Send private message
gr0x0rd
Guru
Guru


Joined: 12 Aug 2006
Posts: 311

PostPosted: Tue Jun 01, 2010 11:06 pm    Post subject: Reply with quote

Thanks, that's got it! Well, except for the fact that my second UPS isn't responding over snmp, despite being fully accessible via telnet and a browser. :x

Not sure I follow you, from what I've read apcupsd can only support one UPS per instance. I have around 15 servers, some of them virtualization base systems running multiple VMs, connected to a number of different UPS devices. What I'm trying to achieve is, in the event of a power failure, if machine a,b and c is connected to UPS x and it's battery level reaches z, the shutdown procedure begins for all machines connected to UPS x based on the order I've predetermined. Can't see how I'd be able to accomplish this with only a single instance of apcupsd unless all servers were connected to a single UPS...
_________________
~g
emerge -FML...
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23082

PostPosted: Wed Jun 02, 2010 2:02 am    Post subject: Reply with quote

gr0x0rd wrote:
What I'm trying to achieve is, in the event of a power failure, if machine a,b and c is connected to UPS x and it's battery level reaches z, the shutdown procedure begins for all machines connected to UPS x based on the order I've predetermined. Can't see how I'd be able to accomplish this with only a single instance of apcupsd unless all servers were connected to a single UPS...
We need to distinguish between multiple instances of apcupsd running on a single Linux system versus multiple Linux systems each running a single instance of apcupsd. You appear to be trying to do the former. I suggested doing the latter, where there is one apcupsd on machine A and machine A is connected to the UPS by way of a serial cable or USB cable. Machines B and C run apcupsd slaves that receive commands from machine A via a TCP connection. Alternatively, you could run the apcupsd only on machine A, and have part of its powerfailure procedure be to run ssh B /sbin/shutdown -h now. It would need an ssh key preconfigured so that it could authenticate without human assistance.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum