[Nut-upsuser] two MGE Ellipse 1500 ups via usb

Arjen de Korte nut+users at de-korte.org
Tue Nov 17 19:26:06 UTC 2009

Citeren Thomas Gutzler <thomas.gutzler op gmail.com>:

> My setup is this: I have 6 computers on 2 UPSs (3 each). Boths UPSs have
> equal power ratings but the load on the slave is less. They are both
> connected to and monitored by the same computer (I call it monitor); one
> UPS is configured as master (the one with the monitor on it) and the
> other is configured as slave. The computers connected to slave should
> shut down first because they're nfs mounting from one of the computers
> on the master UPS.
> Assuming that the master runs out of battery first, my understanding is
> that I could catch the master's LOWBATT notice and use it to shut down
> the computers on the slave (via ssh <host> poweroff) and then catch the
> master's FSD to shut down the computers on the master excluding the
> monitor because that one is brought down last (to runlevel 0) by upsmon
> executing SHUTDOWNCMD. Is there a smarter way doing it - perhaps setting
> sdorder?

There is. You can do this much better entirely in the upsmon.conf  
files on the various systems, without having to write your own  
shutdown scripts. The trick is that there should be one decision  
moment when it is time to commence shutting down of *all* systems.  
Otherwise you risk that if the power returns before all systems go  
critical, some of them won't shutdown and others that have already  
started shutting down, won't be restarted. You don't want that if this  
happens at 3am...

The most convenient location to do this, is on the system that is  
attached to the UPS'es. System controlling the UPS'es (monitor):

    MONITOR ups1 op localhost 1 monmaster blah master
    MONITOR ups2 op localhost 1 monmaster blah master

System running the NFS:

    MONITOR ups1 op monitor.example.com 1 monslave blah slave

All other systems:

    MONITOR ups1 op monitor.example.com 1 monslave blah slave
    MONITOR ups1 op monitor.example.com 1 monslave blah slave

The above will initiate the shutdown sequence when either of the two  
UPS devices goes critical (On Battery and Low Battery at the same  
time). The NFS system will wait 120 seconds before the SHUTDOWNCMD is  
sent, all others will do so after 5 seconds (which means that they  
have almost two minutes before the NFS will shutdown).

Note that you need a fairly long 'offdelay' for at least 'ups1', since  
the monitor system will start the shutdown sequence long before the  
NFS will. The minimum time needed, is the time it takes to shutdown  
the NFS + 120 seconds in this example. You can prevent the risk of  
'ups1' shutting down before the NFS is ready to lose power, by running  
the monitoring from the NFS system. Generally, the system that needs  
to be powered longest should run the master upsmon(s). In that case,  
an offdelay of a couple of seconds is sufficient.

You'll want to guarantee that there is ample of power left when the  
systems start shutting down (because there is a substantial delay  
between that and the actual shutdown), so set the 'battery.charge.low'  
not lower than something like 50% and also the restart level to the  
same (although not all UPS devices support the latter).

> To make sure both UPSs shut down, I write a shutdown script for runlevel
> 0 which checks for the existence of POWERDOWNFLAG, runs upsdrvctl
> shutdown for all UPSs and possibly a shutdown -P now. Fortunately,
> ubuntu comes with such a script (K50nut) but it has to be executed with
> the parameter 'poweroff', not 'stop'. So, am I supposed to write a
> shutdown script /etc/rc0.d/K99upspoweroff that calls '/etc/rc0.d/K50nut
> poweroff'?

Not if you use the above upsmon configuration, assuming that the  
people of Ubuntu created a proper shutdown script.

> What's left but not necessary is to make sure that 'Interval to wait
> after shutdown with delay command (seconds)' on my master UPS is long
> enough for the monitor to power off properly after being halted.

By the time 'upsdrvctl shutdown' runs, all systems should be ready for  
loss of power. Most already will have powered off already, but you'll  
want to make sure that the controlling systems doesn't shutdown before  
the NFS system. In order to be able to restart if the power returns in  
the mean time, 'ondelay' must be higher than 'offdelay'.

Best regards, Arjen
Please keep list traffic on the list

More information about the Nut-upsuser mailing list