He said it used a variant of the megatec protocol, so its not an APC. The UPS I like the most right now is a cheap 1.7 kVA interactive one. Costs $395 +GST, and it monitors perfectly with NUT.
http://www.cdlnz.com/cdl.html?VS=p&G=UPS1700D&P=UPS300&ID=3560494 Model is a UPS1700D and is the same as horse lives on. -----Original Message----- From: Chris Hellyar [mailto:[EMAIL PROTECTED] Sent: Wednesday, 6 September 2006 9:09 p.m. To: [email protected] Subject: Re: Mini howto: Chain shutdown commands for OpenUPSmartd What breed of UPS are you using? If it's an APC there is apcupsd which is a good tool... I use it at home to monitor one ups and shutdown two boxes, and also on my workstation. We also use it at work on all our gear, both windows and Linux with a Linux master. It's also got a cutesy web admin screen thingy to monitor activity. Even if you don't have an APC ups you can monitor 'dumb' signaling UPS's with it on a tty port. Cheers, Me. Rex Johnston wrote: > Hi all, > > Had a fun time yesterday afternoon trying to make one machine > supervise the shutdown of another. > > The situation is this... > > UPS, serial connection to server A, has server A and server B > connected to power outlets. > > The UPS in question will only talk to OpenUPSmartd, which is a single > machine daemon, and the > documentation suggests that it is compatible with pretty much > everything, however, the site > suggested (www.ups-software-download.com) has a pretty woeful > selection of software, and i > didn't like the look of the linux version. > > Anyway, OpenUPSmartd is the software you want. Missing is a startup > script... > > [EMAIL PROTECTED]:~$ cat /etc/init.d/openupsmartd > #!/bin/sh > > PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin > > set -e > > case "$1" in > start) > test -x /usr/local/bin/openupsmartd || exit 0 > > nohup /usr/local/bin/openupsmartd > /var/log/openupsmartd.out 2>&1 & > ;; > stop) > killall openupsmartd > ;; > esac > > > You'll know it's working fine when you see this in syslog > > Sep 6 12:41:59 serverA openupsmartd: IN:234.40V, FAULT:233.90V, > OUT:231.30V, LOAD:13.00% ^I^I^I INFREQ:50.00hz, BATT:27.70V, TEMP:25. > 00C, FLAGS 00001001 ^I^I^I ( FLAG_BEEPER FLAG_STANDBY ) > > Now, this has to control 2 machines, not just this one... > > link the configuration file from where it installs it to where it > expects it > lrwxrwxrwx 1 root root 31 Aug 15 13:44 > /etc/openupsmart.conf -> /usr/local/etc/openupsmart.conf > > and edit thus... > use_syslog=y > shutdown_command="/root/scripts/start_shutdown" > restore_command="/root/scripts/stop_shutdown" > > serverA:~/scripts# cat start_shutdown > #!/bin/bash > > nohup /sbin/shutdown -h +4 < /dev/null > /dev/null 2>&1 & > ssh [EMAIL PROTECTED] /root/scripts/start_shutdown & > serverA:~/scripts# cat stop_shutdown #!/bin/bash > > nohup /sbin/shutdown -c < /dev/null > /dev/null 2>&1 & > ssh [EMAIL PROTECTED] /root/scripts/stop_shutdown & > > Now you need to set up an rsa key on serverB so that serverA can > connect via ssh without a password. > There are numerous places this is described, i set up 2 accounts, > "shutdown" and "noshutdown", > the first to initiate the shutdown of serverB, the second to stop it > when/if the power is restored. > It's easier to grep for events in the log file this way. > > Once done, you need these on serverB > serverB:~/scripts# cat start_shutdown > #!/bin/bash > > nohup /sbin/shutdown -h +3 & > serverB:~/scripts# cat stop_shutdown > #!/bin/bash > > nohup /sbin/shutdown -c & > > > Now create a shutdown group, make sure that shutdown (&noshutdown) are > by default that group, > [EMAIL PROTECTED]:~$ id > uid=1130(shutdown) gid=1044(shutdown) groups=1044(shutdown) > > and alter the permissions on /sbin/shutdown so it looks like this... > > [EMAIL PROTECTED]:~$ ls -l /sbin/shutdown > -rwsr-x--- 1 root shutdown 17388 Sep 5 15:00 /sbin/shutdown > > (that's 4750, NOT 4755) > > make sure that only shutdown (&noshutdown) are in this group. > > Now comes the tricky bit. > > When shutdown is called with a delay, it creates a file called > /etc/nologin which contains > the text displayed before the ssh daemon kicks you off. If you have a > later version of sysvinit, > you can modify /etc/pam.d/ssh to stop this behaviour. Earlier > versions of sshd have this built in, > and non-defeatable. The upshot of this nasty behaviour is that once > shutdown is called on serverB, > serverA can't log back in to stop this shutdown when/if power is > restored. > What to do? > > I used apt-src to install sysvinit tools and edited > > src/shutdown.c like this... > > /* Give warnings on regular intervals and finally shutdown. */ > if (wt < 15 && !needwarning(wt)) warn(wt); > while(wt) { > if (wt <= 5 && !didnolog) { > // donologin(wt); > didnolog++; > } > if (needwarning(wt)) warn(wt); > hardsleep(60); > wt--; > } > > before installing. > > > Cheers, Rex > >
