[Nut-upsuser] Additional server eralier shutdown condition

Peter Selinger selinger at mathstat.dal.ca
Mon Feb 5 08:29:41 CET 2007


Vladimir,

as Charles already pointed out, you can do what you want by writing a
few lines of shell script and arranging for the script to be called
when the UPS goes on battery.

# shut down when battery charge goes below $minlevel
minlevel=30
# check every $interval seconds
interval=5

while upsc myups at localhost ups.status | grep -qw OB; do
      level = `upsc myups at localhost battery.charge`
      if test "$level" -lt "$minlevel"; then
         # shutdown
	 upsmon -c fsd
      fi
      sleep "$interval"
done

This should do the trick. -- Peter

Vladimir I. Umnov wrote:
> 
> Charles Lepple:
> > On 2/2/07, Vladimir I. Umnov <umnov at kirov.ertelecom.ru> wrote:
> >> This means that NUT with upssched set their own timer. I think this 
> >> is missing functionality.
> >> I need UPS monitoring software query my UPSes (APC cannot work with 
> >> many UPSes in native mode,
> >> but can do such query) for current battery level and current 
> >> estimated run time each 5 seconds.
> >> And if it reaches configured value, take appropriate action.
> >
> > You should consider that many USB UPSes will take longer than 5
> > seconds to update everything.
> >
> > Rob is still correct in that you probably want to wait for an "on
> > battery" signal for the UPS. Then you can poll it with whatever you
> > want, including upsc in a loop, or your own custom client. The network
> > protocol is not difficult.
> >
> > There are only a few good reasons to poll the battery level while the
> > UPS is online; namely, you did not allow it enough time to recharge
> > before coming back online after a power failure, the battery is bad,
> > etc. A good UPS will monitor these things during the self-test.
> >
> > Also, a lot of the UPSes supported by NUT will allow you to adjust the
> > battery level at which they send the "low battery" signal. This
> > automates your scenario somewhat.
> 
> That words sounds like NUT is featureless and may be used in small 
> enviroment. For big server rooms with many types of hardware (without 
> distant power off capability) and with goal to run this for longest 
> possible time NUT is very very bad for now.
> You should think about it. And this must be done not in drivers - it 
> should be integrated directly into upsmon!!!



More information about the Nut-upsuser mailing list