On Dec 2, 2015, at 12:59 PM, Olav Seyfarth <o...@seyfarth.de> wrote:
> 
> Dear list members,
> 
> I'd like to setup my UPS in a way that it only shuts the server
> (including 5 VMs down if really necessary). We do have a rather stable
> power supply here, but there are multiple 200ms outages within a year
> and there also have been some that lasted more than half an hour. So:
> since the shudown is rather quick, I'd ideally set it to "shut down when
> only 20% battery left" (which should give at least five minutes power
> left, shutdown takes far less than one minute). BUT:
> 
> I'm not sure if what I did should suffice. I followed the manual
> [http://www.networkupstools.org/docs/user-manual.chunked/ar01s06.html#UPS_shutdown].
> But I may not have understand it properly. If I interpret it correctly,
> the following upsmon.conf would be sufficient to monitor and to initiate
> a system shutdown. Or is it *necessary* to setup the NOTIFYMSG and
> NOTIFYFLAG lines?

NOTIFYMSG and NOTIFYFLAG are not necessary to make the SHUTDOWNCMD work.

However, if you want to use `upssched` and its timers, then NOTIFYCMD and 
`NOTIFYFLAG ... EXEC` are needed.

> RUN_AS_USER nut
> MONITOR Best_Power_Patriot_Pro_750@localhost 1 upsmon SOMESECRET master
> MINSUPPLIES 1
> SHUTDOWNCMD "/sbin/shutdown -h +0"
> POLLFREQ 5
> POLLFREQALERT 5
> HOSTSYNC 15
> DEADTIME 15
> POWERDOWNFLAG /etc/killpower
> RBWARNTIME 43200
> NOCOMMWARNTIME 300
> FINALDELAY 5

This should be sufficient. (Many of those are default values, too, if you want 
to simplify that file.)
> 
> I am unsure since I found that another UPS
> [http://bernaerts.dyndns.org/linux/75-debian/335-debian-wheezy-install-monitor-eaton-ups]
> seems to feature a power threshold ...
> 
>> # upsc eaton@localhost
>> battery.charge: 89
>> *battery.charge.low: 20*
>> ...
> 
> ... but mine does not:
> 
>> # upsc Best_Power_Patriot_Pro_750
>> Init SSL without certificate database
>> battery.charge: 100.0
>> battery.voltage: 27.5
>> battery.voltage.nominal: 24
>> device.mfr: Best Power
>> device.model: Patriot Pro 750
>> device.type: ups
>> driver.name: bestups
>> driver.parameter.pollinterval: 2
>> driver.parameter.port: /dev/ttyS0
>> driver.version: 2.7.2
>> driver.version.internal: 1.06
>> input.frequency: 50.0
>> input.voltage: 231.1
>> input.voltage.nominal: 230
>> output.voltage: 231.1
>> output.voltage.nominal: 230
>> ups.load: 000
>> ups.mfr: Best Power
>> ups.model: Patriot Pro 750
>> ups.status: OL
> 
> So I wonder whether it triggers (at which point? when totally depleted?)
> IN TIME to enable a clean shutdown.

It is unclear what threshold the UPS uses to determine when to send the LB 
signal - it is not in any of the manuals I have seen. I thought I had some 
battery.charge logs from a Patriot Pro II, but I don't really remember doing 
deep discharge tests.

For future reference, the latest code (post-2.7.3) in nutdrv_qx can send the 
"TL" command ("test.battery.start.deep"), which tests the battery until the UPS 
considers it low. You might be able to get away with sending that command to 
the UPS manually (using "echo"), or by temporarily stopping the driver, and 
running minicom or another terminal emulator. Then, you can log the 
battery.charge values over time. I would recommend plugging in a dummy load 
(such as a lamp) to speed up the discharge process.

> Could someone please point me to where (or what for) to look to
> configure that? Or is it not necessary? Or is my UPS not capable of
> triggering based on power left and I must use a time based setup (sleep
> in notifycmd) shown in this
> [https://srackham.wordpress.com/2013/02/27/configuring-nut-for-the-eaton-3s-ups-on-ubuntu-linux/]
> article? Or should I really have a script as complicated as in this
> [http://rogerprice.org/NUT.html] article? I really wan to keep things as
> simple as possible...

Although we generally recommend this for an UPS that provides either 
battery.charge or battery.runtime (for yours, battery.charge is estimated by 
the driver), there is an "ignorelb" flag that would allow you to shut down at 
an arbitrary battery.charge level (once the power goes out, of course). Then 
you don't need to worry about timers.

http://www.networkupstools.org/docs/man/ups.conf.html#_global_directives

> The next thing is, that it seems to be necessary to tweak shutdown
> procedures. I'm on jessie, does anyone know where the debian maintainer
> EXPECTS me to do so? (Or don't I have to?)

Theoretically, the Debian shutdown scripts should have been modified already. I 
don't speak systemd natively, so I'm not sure what to look for there, but it 
used to work with sysvinit.

-- 
Charles Lepple
clepple@gmail




_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to