<html><head></head><body><div dir="ltr">I'm not sure I understand your question. The UPS was running for more than 15 minutes before it went below the
<span style="font-family:monospace">battery.charge.low:</span> of 70.<div><br></div><div>Below is my /etc/nut/nut.conf. </div><div><br></div><div>My goal is that when the UPS report a battery.charge.low of < 70 (or, if possible has been running for 5 minutes) it starts the shutdown process. The shutdown process should take 15 minutes so that proxmox can shutdown guests and then safely shut down itself..</div><div><br></div><div>Thanks<br><div><br></div><div><font face="monospace">root@proxmox-01:~# cat /etc/nut/nut.conf <br># Network UPS Tools: example nut.conf<br>#<br>##############################################################################<br># General section<br>##############################################################################<br># The MODE determines which part of the NUT is to be started, and which<br># configuration files must be modified.<br>#<br># This file try to standardize the various files being found in the field, like<br># /etc/default/nut on Debian based systems, /etc/sysconfig/ups on RedHat based<br># systems, ... Distribution's init script should source this file to see which<br># component(s) has to be started.<br>#<br># The values of MODE can be:<br># - none: NUT is not configured, or use the Integrated Power Management, or use<br># some external system to startup NUT components. So nothing is to be started.<br># - standalone: This mode address a local only configuration, with 1 UPS<br># protecting the local system. This implies to start the 3 NUT layers (driver,<br># upsd and upsmon) and the matching configuration files. This mode can also<br># address UPS redundancy.<br># - netserver: same as for the standalone configuration, but also need<br># some more network access controls (firewall, tcp-wrappers) and possibly a<br># specific LISTEN directive in upsd.conf.<br># Since this MODE is opened to the network, a special care should be applied<br># to security concerns.<br># - netclient: this mode only requires upsmon.<br>#<br># IMPORTANT NOTE:<br># This file is intended to be sourced by standard POSIX shell scripts (so<br># there is no guaranteed `export VAR=VAL` syntax) and by systemd on Linux.<br># You MUST NOT use spaces around the equal sign!<br><br>MODE=netserver<br><br># Uncomment this to allow starting the service even if ups.conf has no device<br># sections at the moment. This environment variable overrides the built-in<br># "false" and an optional same-named default flag that can be set in upsd.conf:<br>#ALLOW_NO_DEVICE=true<br>#export ALLOW_NO_DEVICE<br>root@proxmox-01:~# cat nano /etc/nut/ups.conf<br>cat: nano: No such file or directory<br># Network UPS Tools: example ups.conf<br>#<br># --- SECURITY NOTE ---<br>#<br># If you use snmp-ups and set a community string in here, you<br># will have to secure this file to keep other users from obtaining<br># that string. It needs to be readable by upsdrvctl and any drivers,<br># and by upsd.<br>#<br># ---<br>#<br># This is where you configure all the UPSes that this system will be<br># monitoring directly. These are usually attached to serial ports, but<br># USB devices and SNMP devices are also supported.<br>#<br># This file is used by upsdrvctl to start and stop your driver(s), and<br># is also used by upsd to determine which drivers to monitor. The<br># drivers themselves also read this file for configuration directives.<br>#<br># The general form is:<br>#<br># [upsname]<br># driver = <drivername><br># port = <portname><br># < any other directives here ><br>#<br># The section header ([upsname]) can be just about anything as long as<br># it is a single word inside brackets. upsd uses this to uniquely<br># identify a UPS on this system.<br>#<br># If you have a UPS called snoopy, your section header would be "[snoopy]".<br># On a system called "doghouse", the line in your upsmon.conf to monitor<br># and manage it would look something like this:<br>#<br># MONITOR snoopy@doghouse 1 upsmonuser mypassword primary<br>#<br># It might look like this if monitoring in "secondary" mode (without any<br># ability to directly manage the UPS) from a different system:<br>#<br># MONITOR snoopy@doghouse 1 upsmonuser mypassword secondary<br>#<br># Configuration directives<br># ------------------------<br>#<br># These directives are used by upsdrvctl only and should be specified outside<br># of a driver definition:<br>#<br># maxretry: OPTIONAL. Specify the number of attempts to start the driver(s),<br># in case of failure, before giving up. A delay of 'retrydelay' is<br># inserted between each attempt. Caution should be taken when using<br># this option, since it can impact the time taken by your system to<br># start.<br>#<br># The built-in default is 1 attempt.<br>#<br># retrydelay: OPTIONAL. Specify the delay between each restart attempt of the<br># driver(s), as specified by 'maxretry'. Caution should be taken<br># when using this option, since it can impact the time taken by your<br># system to start.<br>#<br># The default is 5 seconds.<br>#<br># chroot: OPTIONAL. Used for securing. See man page for details.<br>#<br># driverpath: OPTIONAL. Used for custom setups. See man page for details.<br>#<br># nowait: OPTIONAL. Tell upsdrvctl to not wait at all for the driver(s)<br># to execute the requested command. Fire and forget.<br>#<br># pollinterval: OPTIONAL. The status of the UPS will be refreshed after a<br># maximum delay which is controlled by this setting (default<br># 2 seconds). This may be useful if the driver is creating too<br># much of a load on your system or network.<br># Note that some drivers also have an option called *pollfreq*<br># which controls how frequently some of the less critical<br># parameters are polled. See respective driver man pages.<br>#<br><br># Set maxretry to 3 by default, this should mitigate race with slow devices:<br>maxretry = 3<br><br># These directives can be set outside and inside a driver definition, with<br># slightly different meanings per context:<br>#<br># maxstartdelay: OPTIONAL. This can be set as a global variable<br># above your first UPS definition and it can also be<br># set in a UPS section. This value controls how long<br># upsdrvctl will wait for the driver to finish starting.<br># This keeps your system from getting stuck due to a<br># broken driver or UPS.<br># The default is 45 seconds.<br>#<br># debug_min: OPTIONAL. Specify a minimum debug level for all driver daemons<br># (when specified at global level), or for this driver daemon<br># (when specified in a driver section), e.g. for troubleshooting<br># a deployment. This does not directly impact the foreground or<br># background running mode. If both the global and driver level<br># `debug_min` are set, the driver-level setting takes precedence.<br># Command-line option `-D` can only increase this verbosity level.<br>#<br># user, group: OPTIONAL. Overrides the compiled-in (also global-section,<br># when used in driver section) default unprivileged user/group<br># name for NUT device driver. Impacts access rights used for<br># the socket file access (group) and communication ports (user).<br>#<br># synchronous: OPTIONAL. The driver work by default in asynchronous<br># mode (like *no*) with fallback to synchronous if sending<br># fails (i.e *synchronous=auto*). This means that all data<br># are pushed by the driver on the communication socket to<br># upsd (Unix socket on Unix, Named pipe on Windows) without<br># waiting for these data to be actually consumed. With<br># some HW, such as ePDUs, that can produce a lot of data,<br># asynchronous mode may cause some congestion, resulting in<br># the socket to be full, and the driver to appear as not<br># connected. By enabling the 'synchronous' flag<br># (value = 'yes'), the driver will wait for data to be<br># consumed by upsd, prior to publishing more. This can be<br># enabled either globally or per driver.<br>#<br># The default is 'no' (i.e. asynchronous mode) for backward<br># compatibility of the driver behavior.<br>#<br><br># These directives are common to all drivers that support ups.conf:<br>#<br># driver: REQUIRED. Specify the program to run to talk to this UPS.<br># apcsmart, bestups, and sec are some examples.<br>#<br># port: REQUIRED. The serial port where your UPS is connected.<br># /dev/ttyS0 is usually the first port on Linux boxes, for example.<br>#<br># sdorder: OPTIONAL. When you have multiple UPSes on your system, you<br># usually need to turn them off in a certain order. upsdrvctl<br># shuts down all the 0s, then the 1s, 2s, and so on. To exclude<br># a UPS from the shutdown sequence, set this to -1.<br>#<br># The default value for this parameter is 0.<br>#<br># desc: optional, to keep a note of the UPS purpose, location, etc.<br>#<br># nolock: optional, and not recommended for use in this file.<br>#<br># If you put nolock in here, the driver will not lock the<br># serial port every time it starts. This may allow other<br># processes to seize the port if you start more than one by<br># mistake.<br>#<br># This is only intended to be used on systems where locking<br># absolutely must be disabled for the software to work.<br>#<br># ignorelb: OPTIONAL. Ignore low battery condition reported by device,<br># and evaluate remaining battery charge or runtime instead.<br># See man page for details.<br>#<br># usb_set_altinterface(=num): OPTIONAL. Require that NUT calls this method<br># to set the interface, even if 0 (default). Some devices require<br># the call to initialize; others however can get stuck due to it -<br># so it is not called by default. Yet others can be composite<br># devices which use a non-zero interface to represent the UPS.<br>#<br># default.<variable>: OPTIONAL. Set a default value for <variable> which is<br># used in case the UPS doesn't provide a value, but which will be<br># overwritten if a value is available from the UPS, e.g.:<br># default.input.voltage.nominal = 230<br># will report the nominal input voltage to be 230, unless the UPS<br># eventually tells us differently.<br>#<br># override.<variable>: OPTIONAL. Set a value for <value> that overrides<br># (for NUT) any value that may be read from the UPS.<br># Used for overriding values from the UPS that are clearly wrong<br># (e.g. some devices report wrong values for battery voltage):<br># override.battery.voltage.nominal = 12<br># Use with caution! This will only change the appearance of the<br># variable to the outside world (and NUT calculations), internally<br># in the UPS the original value is used.<br>#<br># Anything else is passed through to the hardware-specific part of<br># the driver.<br>#<br># Examples<br># --------<br>#<br># A simple example for a UPS called "powerpal" that uses the blazer_ser<br># driver on /dev/ttyS0 is:<br>#<br># [powerpal]<br># driver = blazer_ser<br># port = /dev/ttyS0<br># desc = "Web server"<br>#<br># If your UPS driver requires additional settings, you can specify them<br># here. For example, if it supports a setting of "1234" for the<br># variable "cable", it would look like this:<br>#<br># [myups]<br># driver = mydriver<br># port = /dev/ttyS1<br># cable = 1234<br># desc = "Something descriptive"<br>#<br># To find out if your driver supports any extra settings, start it with<br># the -h option and/or read the driver's documentation.<br><br><br>offdelay = 120<br>ondelay = 240<br><br>[pve1]<br> driver = "usbhid-ups"<br> port = "auto"<br> vendorid = "06DA"<br> productid = "FFFF"<br> desc = "Phoenixtec Power Co., Ltd Innova Unity" <br> serial = "CPANM2436540037"<br> override.battery.charge.low = 70<br> override.battery.runtime.low = 2500<br> # wait 5 minutes for ups to power off<br> override.ups.delay.shutdown = 300</font><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 1 Jun 2024 at 19:12, Jim Klimov <<a href="mailto:jimklimov%2Bnut_at_gmail.com_chribonn@duck.com">jimklimov+nut_at_gmail.com_chribonn@duck.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div style="display:none;font-size:1px;background:rgb(255,255,255);color:rgb(0,0,0);line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden"> Thinking of it, one purpose of upssched is to delay reaction to short-lived flukes (e.g. if we go on battery for 20 seconds and set a delay for 30, if we're back on line within that time frame, it is </div>
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="padding:0px;width:100%;max-width:none;margin:0px auto;background:none transparent" width="100% !important" bgcolor="transparent">
<tbody>
<tr>
<td>
<div style="margin:0px auto;max-width:800px">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="padding:0px;margin:0px;width:100%;max-width:none" width="100% !important">
<tbody>
<tr>
<td style="direction:ltr;font-size:0px;padding:0px 0px 20px;text-align:center">
<div style="border-left:3px solid rgb(222,88,51);background:rgb(238,238,238);margin:0px auto;max-width:800px">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="line-height:normal;padding:0px;margin:0px;width:100%;max-width:none;background:rgb(238,238,238)" width="100% !important" bgcolor="#eeeeee">
<tbody>
<tr>
<td style="line-height:normal;direction:ltr;font-size:0px;padding:10px 6px 10px 14px;text-align:center;background:rgb(238,238,238)" align="center" bgcolor="#eeeeee">
<div style="font-size:0px;line-height:0;text-align:left;display:inline-block;width:100%;direction:ltr;background-color:rgb(238,238,238)">
<div style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:middle;width:68%">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="line-height:normal;vertical-align:middle;padding:0px;margin:0px;width:100%;max-width:none;background:rgb(238,238,238)" width="100% !important" valign="middle" bgcolor="#eeeeee">
<tbody>
<tr>
<td align="left" style="line-height:normal;font-size:0px;padding:0px;word-break:break-word;background:rgb(238,238,238)" bgcolor="#eeeeee">
<div style="font-family:"Proxima Nova",proxima-nova,-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;line-height:20px;text-align:left;text-decoration:none;text-transform:none;color:rgb(51,51,51)"><b style="color:rgb(222,88,51)">DuckDuckGo</b> did not detect any trackers. <span style="display:inline">
</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:middle;width:31%">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="line-height:normal;vertical-align:middle;padding:0px;margin:0px;width:100%;max-width:none;background:rgb(238,238,238)" width="100% !important" valign="middle" bgcolor="#eeeeee">
<tbody>
<tr>
<td align="right" style="line-height:normal;font-size:0px;padding:0px;word-break:break-word;background:rgb(238,238,238)" bgcolor="#eeeeee">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse:separate;line-height:100%;padding:0px;margin:0px;max-width:none;background:rgb(238,238,238);width:auto" bgcolor="#eeeeee">
<tbody>
<tr>
<td align="center" bgcolor="#eeeeee" role="presentation" style="line-height:normal;border:1px solid rgb(209,209,209);border-radius:8px;font-style:normal;background:rgb(238,238,238)" valign="middle">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table></div><div dir="ltr"><div>Thinking of it, one purpose of upssched is to delay reaction to short-lived flukes (e.g. if we go on battery for 20 seconds and set a delay for 30, if we're back on line within that time frame, it is ok to go on living).</div><div><br></div><div>I wonder if your UPS went under 70% and you aborted the experiment too early (compared to the delay you had set, possibly with a margin for the frequency of UPS polling rate and regular `upsmon` interactions with `upsd` - typically 5 to 30 sec each)?..</div><div><br></div><div>Jim</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 1, 2024 at 1:32 PM Alan via Nut-upsuser <<a href="mailto:nut-upsuser@alioth-lists.debian.net" target="_blank">nut-upsuser@alioth-lists.debian.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="ltr"><div class="gmail_quote"><div>Hi,</div><div><br></div><div>A while back I set up a NUT server on a debian machine (Proxmox). I followed the guide at <a href="https://wiki.debian.org/Exim4Gmail" target="_blank">https://wiki.debian.org/Exim4Gmail</a> so that I would receive email notifications and verified that emails work.</div><div><br></div><div>I modified .<b>/etc/nut/upssched-cmd</b> and modified the script to send an email (happy to share).</div><div><br></div><div>I then wanted to test the solution so I unplugged the UPS.</div><div>NUT wrote a message to the console and I received an email to inform me that the UPS was on battery. </div><div><br></div><div>I had configured the battery.charge.low: 70 and battery.runtime.low: 2500. My thought was when one of these conditions are met the server would bring down the guests and shut itself down. The UPS battery.charge went under 70 but nothing happened. Below is the output from upsc and what happened when I plugged the power back into the ups.</div><div><br></div><div>upsc pve1@localhost<br><font face="monospace">Init SSL without certificate database<br>battery.charge: 63<br>battery.charge.low: 70<br>battery.runtime: 3133<br>battery.runtime.low: 2500<br>battery.type: PbAc<br>battery.voltage: 36.80<br>battery.voltage.nominal: 36.00<br>device.mfr: PHOENIXTEC<br>device.model: Innova Unity<br>device.serial: CPANM2436540037<br>device.type: ups<br><a href="http://driver.name" target="_blank">driver.name</a>: usbhid-ups<br>driver.parameter.pollfreq: 30<br>driver.parameter.pollinterval: 2<br>driver.parameter.port: auto<br>driver.parameter.productid: FFFF<br>driver.parameter.serial: CPANM2436540037<br>driver.parameter.synchronous: auto<br>driver.parameter.vendorid: 06DA<br>driver.version: 2.8.0<br>driver.version.data: Phoenixtec/Liebert HID 0.41<br>driver.version.internal: 0.47<br>driver.version.usb: libusb-1.0.26 (API: 0x1000109)<br>output.frequency: 50.00<br>output.voltage: 229.6<br>ups.delay.shutdown: 300<br>ups.load: 13<br>ups.mfr: PHOENIXTEC<br>ups.model: Innova Unity<br>ups.productid: ffff<br>ups.serial: CPANM2436540037<br>ups.status: OB DISCHRG<br>ups.vendorid: 06da</font><br> </div><div><b><< UPS plugged back in >></b></div><div> <br><font face="monospace">Broadcast message from root@proxmox-01 (somewhere) (Sat Jun 1 12:36:17 2024): <br> <br>UPS pve1@localhost on line power </font><br></div><div><br></div><div>How can I diagnose / resolve this?</div><div><br></div><div>Thanks</div><div>Alan</div><div><br></div><div> </div></div></div>
</div>
_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
</blockquote></div>
</div>
</blockquote></div>
</body></html>