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