<!doctype html public "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>Controlling Multiple UPSes on one Machine</title> <meta name="Author" content="Kern Sibbald"> <link rel=stylesheet href="apcupsd-styles.css" type="text/css"> </head> <body> <h1>Controlling Multiple UPSes on one Machine</h1> <h2>General</h2> You may want to use your server to control multiple UPSes. With <b>apcupsd</b> version 3.8.3 or later, this is possible by proper configuration and by running one copy of <b>apcupsd</b> for each UPS to be controlled. <p></p>A multiple UPS configuration might be configured like the following diagram: <pre> Multi-UPS Configuration (apcupsd 3.8.3 only) --------------------- serial port ------ | | <============> | | | Computer A running | Power | UPS | | two copies of | <============= | 1 | | apcupsd | ------ | | serial port ------ | | <============> | | --------------------- | UPS | | ==== | 2 | | Ethernet || ------ | || --------------------- || | | || | Computer B running | || | apcupsd in | Power || | slave mode | <=========== | | | | --------------------- </pre> <h2>Configuration</h2> The way to accomplish the above is to ensure that none of the critical files used by each of the two copies of <b>apcupsd</b> are the same. By using suitable configuration options, this is possible. <h3>The First Copy of Apcupsd</h3> For example, assuming you have SmartUPSes in both cases, to configure and install the first copy of <b>apcupsd</b>, which controls a UPS and Computer A, one could use the following configuration: <pre> ./configure \ --prefix=/usr \ --sbindir=/sbin \ --with-cgi-bin=/home/http/cgi-bin \ --enable-cgi \ --with-css-dir=/home/http/css \ --with-log-dir=/etc/apcupsd \ --with-serial-dev=/dev/ttyS0 \ --enable-pthreads \ --with-nis-port=3551 \ --enable-powerflute </pre> This is pretty much a "normal" installation using many of the defaults. Once built and installed, this would control the first UPS and cause a shutdown of the system when the batteries are low. This copy of <b>apcupsd</b> will be started and stopped automatically when the system is booted and halted. <h3>The Second Copy of Apcupsd</h3> To configure and install the second copy of <b>apcupsd</b>, which controls the second UPS and Computer B, you could use the following configuration: <pre> ./configure \ --prefix=$HOME/apcupsd/bin \ --sbindir=$HOME/apcupsd/bin \ --enable-cgi \ --with-cgi-bin=$HOME/apcupsd/bin \ --with-log-dir=$HOME/apcupsd/bin \ --with-pid-dir=$HOME/apcupsd/bin \ --sysconfdir=$HOME/apcupsd/bin \ --with-lock-dir=$HOME/apcupsd/bin \ --with-pwrfail-dir=$HOME/apcupsd/bin \ --with-serial-dev=/dev/ttyS1 \ --enable-pthreads \ --with-nis-port=7001 \ --disable-install-distdir </pre> Note, in this case, we use considerably more configuration options to ensure that the system files are placed in a different directory ($HOME/apcupsd/bin). We have also selected a different serial port and a different NIS (Network Information Server) port. And finally, we have used the <b>--disable-install-distdir</b> option, which prevents <b>make install</b> from doing the final system installation (i.e. the modification of the halt script) since this was previously done. <h3>Important Steps after Installation of the Second Copy</h3> After the <b>make install</b> of the second copy of <b>apcupsd</b> there are a number important steps to complete. You must either remove or modify the file <b>$HOME/apcupsd/bin/apccontrol</b>, so that it will not shutdown Computer A when the battery of UPS 2 is low. One suggestion is to copy <b>examples/safe.apccontrol</b> into <b>$HOME/apcupsd/bin/apccontrol</b>. Alternatively, you could edit the <b>$HOME/apcupsd/bin/apccontrol</b> and delete all statements that attempt to shutdown the machine. <p></p>Another important step is to find a way to shutdown Computer B when UPS 2's battery is low. Probably the simplest way to do this is to edit <b>$HOME/apcupsd/bin/apcupsd.conf</b> on Computer A so that this second copy of <b>apcupsd</b> becomes a network master. Then install a standard slave configuration on Computer B. <p></p>Please remember that if UPS 1's batteries are exhausted before UPS 2's batteries, Computer B may not be properly shutdown. And at the current time, there is no simple means to make the two copies of <b>apcupsd</b> running on Computer A communicate. Thus there are certain risks in such a configuration. However, these configurations can be very useful for powering electronic equipment and such. <p>If Computer B is vitally important, it would probably be better to purchase a serial port card for it, or perhaps use a USB UPS. To ensure that it is properly shutdown if Computer A goes down, you could run a second copy of <b>apcupsd</b> on Computer B as a slave connected to the main copy of <b>apcupsd</b> on Computer A. Thus Computer B would be running two slaves, one driven by the master controlling UPS 1 and the other by the master controlling UPS 2, and Computer B could be shutdown by the first master that signaled it to do so. <hr> <a href="win32.html" target="_self"><img src="back.gif" border=0 alt="Back"></a> <a href="batteries.html" target="_self"><img src="next.gif" border=0 alt="Next"></a> <a href="index.html"><img src="home.gif" border=0 alt="Home"></a> </body> </html>