From 3705ef815d0c9e67e8d4e8c9383b8d40c403019b Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Mon, 16 Mar 2026 22:54:39 -0400 Subject: [PATCH 1/3] nut: ensure correct upsmon settings names Prompted by https://github.com/openwrt/luci/pull/8420#issuecomment-4071252681 we update upsmon configs to ensure they are correct according to upstream. We reorder the options so that they match upstream documentation at to be sure we have not missed any items. While at it, we add configuration options from the upstream documentation that are not currently present in the UCI configs. Signed-off-by: Daniel F. Dickinson --- net/nut/files/nut-monitor.init | 127 +++++++++++++++++++++++++++------ net/nut/files/nut_monitor | 70 +++++++++++++++--- 2 files changed, 164 insertions(+), 33 deletions(-) diff --git a/net/nut/files/nut-monitor.init b/net/nut/files/nut-monitor.init index 9b17d42e5bc3e..2bcd0178b0907 100755 --- a/net/nut/files/nut-monitor.init +++ b/net/nut/files/nut-monitor.init @@ -19,28 +19,26 @@ nut_upsmon_conf() { [ -n "$RUNAS" ] && echo "RUN_AS_USER $RUNAS" >> "$UPSMON_C" runas="$RUNAS" - config_get val "$cfg" minsupplies 1 - echo "MINSUPPLIES $val" >> "$UPSMON_C" - - config_get val "$cfg" shutdowncmd "/usr/sbin/nutshutdown" - echo "SHUTDOWNCMD \"$val\"" >> "$UPSMON_C" - - config_get val "$cfg" notifycmd - [ -n "$val" ] && echo "NOTIFYCMD \"$val\"" >> "$UPSMON_C" - - config_get val "$cfg" pollfreq 5 - echo "POLLFREQ $val" >> "$UPSMON_C" + config_get val "$cfg" deadtime 15 + echo "DEADTIME $val" >> "$UPSMON_C" - config_get val "$cfg" pollfreqalert 5 - echo "POLLFREQALERT $val" >> "$UPSMON_C" + config_get val "$cfg" finaldelay 5 + echo "FINALDELAY $val" >> "$UPSMON_C" config_get val "$cfg" hostsync 15 echo "HOSTSYNC $val" >> "$UPSMON_C" - config_get val "$cfg" deadtime 15 - echo "DEADTIME $val" >> "$UPSMON_C" + config_get val "$cfg" minsupplies 1 + echo "MINSUPPLIES $val" >> "$UPSMON_C" - echo "POWERDOWNFLAG /var/run/killpower" >> "$UPSMON_C" + config_get val "$cfg" nocommwarntime 300 + echo "NOCOMMWARNTIME $val" >> "$UPSMON_C" + + config_get val "$cfg" pollfaillogthrottlemax 1 + echo "POLLFAIL_LOG_THROTTLE_MAX $val" >> "$UPSMON_C" + + config_get val "$cfg" notifycmd + [ -n "$val" ] && echo "NOTIFYCMD \"$val\"" >> "$UPSMON_C" config_get val "$cfg" onlinemsg [ -n "$val" ] && echo "NOTIFYMSG ONLINE \"$val\"" >> "$UPSMON_C" @@ -48,7 +46,7 @@ nut_upsmon_conf() { [ -n "$val" ] && echo "NOTIFYMSG ONBATT \"$val\"" >> "$UPSMON_C" config_get val "$cfg" lowbattmsg [ -n "$val" ] && echo "NOTIFYMSG LOWBATT \"$val\"" >> "$UPSMON_C" - config_get val "$cfg" fsdmsg + config_get val "$cfg" fsdmmsg [ -n "$val" ] && echo "NOTIFYMSG FSD \"$val\"" >> "$UPSMON_C" config_get val "$cfg" commokmsg [ -n "$val" ] && echo "NOTIFYMSG COMMOK \"$val\"" >> "$UPSMON_C" @@ -56,12 +54,54 @@ nut_upsmon_conf() { [ -n "$val" ] && echo "NOTIFYMSG COMMBAD \"$val\"" >> "$UPSMON_C" config_get val "$cfg" shutdownmsg [ -n "$val" ] && echo "NOTIFYMSG SHUTDOWN \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" shutdownhostsyncmsg + [ -n "$val" ] && echo "NOTIFYMSG SHUTDOWN_HOSTSYNC \"$val\"" >> "$UPSMON_C" config_get val "$cfg" replbattmsg [ -n "$val" ] && echo "NOTIFYMSG REPLBATT \"$val\"" >> "$UPSMON_C" config_get val "$cfg" nocommmsg [ -n "$val" ] && echo "NOTIFYMSG NOCOMM \"$val\"" >> "$UPSMON_C" config_get val "$cfg" noparentmsg [ -n "$val" ] && echo "NOTIFYMSG NOPARENT \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" calmsg + [ -n "$val" ] && echo "NOTIFYMSG CAL \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notcalmsg + [ -n "$val" ] && echo "NOTIFYMSG NOTCAL \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" offmsg + [ -n "$val" ] && echo "NOTIFYMSG OFF \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notoffmsg + [ -n "$val" ] && echo "NOTIFYMSG NOTOFF \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" bypassmsg + [ -n "$val" ] && echo "NOTIFYMSG BYPASS \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notbypassmsg + [ -n "$val" ] && echo "NOTIFYMSG NOTBYPASS \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" ecomsg + [ -n "$val" ] && echo "NOTIFYMSG ECO \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notecomsg + [ -n "$val" ] && echo "NOTIFYMSG NOTECO \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" alarmmsg + [ -n "$val" ] && echo "NOTIFYMSG ALARM \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notlarmmsg + [ -n "$val" ] && echo "NOTIFYMSG NOTALARM \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" overmsg + [ -n "$val" ] && echo "NOTIFYMSG OVER \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notovermsg + [ -n "$val" ] && echo "NOTIFYMSG NOTOVER \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" trimmsg + [ -n "$val" ] && echo "NOTIFYMSG TRIM \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" nottrimmsg + [ -n "$val" ] && echo "NOTIFYMSG NOTTRIM \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" boostmsg + [ -n "$val" ] && echo "NOTIFYMSG BOOST \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notboostmsg + [ -n "$val" ] && echo "NOTIFYMSG NOTBOOST \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" othermsg + [ -n "$val" ] && echo "NOTIFYMSG OTHER \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" notothermsg + [ -n "$val" ] && echo "NOTIFYMSG NOTOTHER \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" suspendstaringmsg + [ -n "$val" ] && echo "NOTIFYMSG SUSPEND_STARTING \"$val\"" >> "$UPSMON_C" + config_get val "$cfg" suspendfinishedmsg + [ -n "$val" ] && echo "NOTIFYMSG SUSPEND_FINISHED \"$val\"" >> "$UPSMON_C" notifylist() { local value="$1" @@ -85,7 +125,7 @@ nut_upsmon_conf() { else echo "$optval" fi - } + } local default optval val="" @@ -102,16 +142,56 @@ nut_upsmon_conf() { echo "NOTIFYFLAG REPLBATT $(setnotify "$cfg" replbattnotify)" ; \ echo "NOTIFYFLAG NOCOMM $(setnotify "$cfg" nocommnotify)" ; \ echo "NOTIFYFLAG NOPARENT $(setnotify "$cfg" noparentnotify)" ; \ + echo "NOTIFYFLAG CAL $(setnotify "$cfg" calnofify)"; \ + echo "NOTIFYFLAG NOTCAL $(setnotify "$cfg" nocalnotify)"; \ + echo "NOTIFYFLAG OFF $(setnotify "$cfg" offnotify)"; \ + echo "NOTIFYFLAG NOTOFF $(setnotify "$cfg" notoffnotify)"; \ + echo "NOTIFYFLAG BYPASS $(setnotify "$cfg" bypassnotifyBYPASS)"; \ + echo "NOTIFYFLAG NOTBYPASS $(setnotify "$cfg" notbypassnotify)"; \ + echo "NOTIFYFLAG ECO $(setnotify "$cfg" echonotify)"; \ + echo "NOTIFYFLAG NOTECO $(setnotify "$cfg" noteconotify)"; \ + echo "NOTIFYFLAG ALARM $(setnotify "$cfg" alarmnotify)"; \ + echo "NOTIFYFLAG NOTALARM $(setnotify "$cfg" notalarmnotify)"; \ + echo "NOTIFYFLAG OVER $(setnotify "$cfg" overnotify)"; \ + echo "NOTIFYFLAG NOTOVER $(setnotify "$cfg" notovernotify)"; \ + echo "NOTIFYFLAG TRIM $(setnotify "$cfg" trimnotify)"; \ + echo "NOTIFYFLAG NOTTRIM $(setnotify "$cfg" nottrimnotify)"; \ + echo "NOTIFYFLAG BOOST $(setnotify "$cfg" boostnotify)"; \ + echo "NOTIFYFLAG NOTBOOST $(setnotify "$cfg" notboostnotify)"; \ + echo "NOTIFYFLAG OTHER $(setnotify "$cfg" othernotify)"; \ + echo "NOTIFYFLAG NOTOTHER $(setnotify "$cfg" notothernotify)"; \ + echo "NOTIFYFLAG SUSPEND_STARTING $(setnotify "$cfg" suspendstaringnotify)"; \ + echo "NOTIFYFLAG SUSPEND_FINISHED $(setnotify "$cfg" suspendfinishednotify)" } >> "$UPSMON_C" + config_get val "$cfg" pollfreq 5 + echo "POLLFREQ $val" >> "$UPSMON_C" + + config_get val "$cfg" pollfreqalert 5 + echo "POLLFREQALERT $val" >> "$UPSMON_C" + + echo "POWERDOWNFLAG /var/run/killpower" >> "$UPSMON_C" + + config_get val "$cfg" offduration 30 + echo "OFFDURATION $val" >> "$UPSMON_C" + + config_get val "$cfg" offduration -1 + echo "OVERDURATION $val" >> "$UPSMON_C" + + config_get val "$cfg" oblbduration 0 + echo "OBLBDURATION $val" >> "$UPSMON_C" + config_get val "$cfg" rbwarntime 43200 echo "RBWARNTIME $val" >> "$UPSMON_C" - config_get val "$cfg" nocommwarntime 300 - echo "NOCOMMWARNTIME $val" >> "$UPSMON_C" + config_get val "$cfg" alarmcritical 1 + echo "ALARMCRITICAL $val" >> "$UPSMON_C" - config_get val "$cfg" finaldelay 5 - echo "FINALDELAY $val" >> "$UPSMON_C" + config_get val "$cfg" shutdownexit 0 + echo "SHUTDOWNEXIT $val" >> "$UPSMON_C" + + config_get val "$cfg" shutdowncmd "/usr/sbin/nutshutdown" + echo "SHUTDOWNCMD \"$val\"" >> "$UPSMON_C" config_get val "$cfg" certpath if [ -n "$val" ]; then echo "CERTPATH $val" >> "$UPSMON_C"; fi @@ -122,6 +202,9 @@ nut_upsmon_conf() { config_get_bool val "$cfg" forcessl 0 if [ -n "$val" ]; then echo "FORCESSL $val" >> "$UPSMON_C"; fi + config_get_bool val "$cfg" debugmin 0 + if [ -n "$val" ]; then echo "DEBUG_MIN $val" >> "$UPSMON_C"; fi + havemon=1 } diff --git a/net/nut/files/nut_monitor b/net/nut/files/nut_monitor index a3de4f5de403a..c123ba1d3765d 100644 --- a/net/nut/files/nut_monitor +++ b/net/nut/files/nut_monitor @@ -1,23 +1,43 @@ #config upsmon 'upsmon' # option runas nutmon +# option deadtime 15 +# option finaldelay 5 # final delay +# option hostsync 15 # option minsupplies 1 -# option shutdowncmd '/usr/sbin/nutshutdown' +# option nocommwarntime 300 # no communications warn time +# option pollfaillogthrottlemax -1 # option notifycmd /path/to/cmd -# list defaultnotify SYSLOG # can be SYSLOG or EXEC or IGNORE -# option pollfreq 5 -# option pollfreqalert 5 -# option hostsync 15 -# option deadtime 15 # option onlinemsg "online message" # option onbattmsg "on battery message" # option lowbattmsg "low battery message" # option fsdmsg "forced shutdown message" -# option comokmsg "communications restored message" -# option combadmsg "communications bad message" +# option commokmsg "communications restored message" +# option commbadmsg "communications bad message" # option shutdowmsg "shutdown message" +# option shutdowhostsyncmsg "shutdown_hostsync message" # option replbattmsg "replace battery message" # option nocommmsg "no communications message" # option noparentmsg "no parent message" +# option calmsg "cal message" +# option notcalmsg "not cal message" +# option offmsg "off message" +# option notoffmsg "not off message" +# option bypassmsg "bypass message" +# option notbypassmsg "not bypass message" +# option ecomsg "eco message" +# option notecomsg "not eco message" +# option alarmmsg "alarm message" +# option notlarmmsg "not larm message" +# option overmsg "over message" +# option notovermsg "not over message" +# option trimmsg "trim message" +# option nottrimmsg "not trim message" +# option boostmsg "boost message" +# option notboostmsg "not boost message" +# option othermsg "other message" +# option notothermsg "not other message" +# option suspendstaringmsg "suspend staring message" +# option suspendfinishedmsg "suspend finished message" # list onlinenotify SYSLOG # can be SYSLOG or EXEC or IGNORE # list onbattnotify SYSLOG # can be SYSLOG or EXEC or IGNORE # list lowbattnotify SYSLOG # can be SYSLOG or EXEC or IGNORE @@ -28,12 +48,40 @@ # list replbattnotify SYSLOG # can be SYSLOG or EXEC or IGNORE # list nocommnotify SYSLOG # can be SYSLOG or EXEC or IGNORE # list noparentnotify SYSLOG # can be SYSLOG or EXEC or IGNORE -# option rbwarntime 4200 # replace battery warn time -# option nocommwarntime 300 # no communications warn time -# option finaldelay 5 # final delay +# list calnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list notcalnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list offnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list notoffnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list bypassnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list notbypassnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list econotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list noteconotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list alarmnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list notify SYSLOG # can be SYLOG or EXEC or IGNORE +# list overnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list notovernotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list trimnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list nottrimnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list boostnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list notboostnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list othernotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list notothernotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list suspendstaringnotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list suspendfinishednotify SYSLOG # can be SYLOG or EXEC or IGNORE +# list defaultnotify SYSLOG # can be SYSLOG or EXEC or IGNORE +# option pollfreq 5 +# option pollfreqalert 5 +# option offduration 30 +# option overduration -1 +# option oblbduration 0 +# option shutdowncmd '/usr/sbin/nutshutdown' +# option rbwarntime 43200 # replace battery warn time +# option alarmcritical 1 +# option shutdownexit 0 # option certpath /path/to/ca/dir # option certverify 0 # option forcessl 0 +# option debugmin 0 #config master # option upsname upsname From f25be105a6c01aac7500aac8682583900d51cb30 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Mon, 16 Mar 2026 23:06:13 -0400 Subject: [PATCH 2/3] nut: update deprecated upsmon/upsd names Some years ago upstream changed the names the primary/secondary UPS system/monitor from master/slave to primary/secondary. It is uncertain how much longer these deprecated names will be accepted by NUT. Therefore update naming to match upstream documentation and configuration. See , , and . Signed-off-by: Daniel F. Dickinson --- net/nut/Makefile | 2 +- net/nut/files/nut-monitor.init | 8 ++++++-- net/nut/files/nut_monitor | 4 ++-- net/nut/files/nut_server | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/net/nut/Makefile b/net/nut/Makefile index da68d6809099c..095ede0812af6 100644 --- a/net/nut/Makefile +++ b/net/nut/Makefile @@ -156,7 +156,7 @@ part of UPS monitoring--shutting down the system when the power goes out. It can call out to other helper programs for notification purposes during power events. upsmon can monitor multiple systems using a single process. Every UPS that is defined in the upsmon.conf configuration file -is assigned a power value and a type (slave or master). +is assigned a power value and a type (secondary or primary). endef define Package/nut-upsmon/conffiles diff --git a/net/nut/files/nut-monitor.init b/net/nut/files/nut-monitor.init index 2bcd0178b0907..ff89e15066cdd 100755 --- a/net/nut/files/nut-monitor.init +++ b/net/nut/files/nut-monitor.init @@ -240,8 +240,12 @@ build_config() { config_load nut_monitor config_foreach nut_upsmon_conf upsmon - config_foreach nut_upsmon_add master master - config_foreach nut_upsmon_add slave slave + config_foreach nut_upsmon_add primary primary + config_foreach nut_upsmon_add secondary secondary + + # handle deprecated configuration names + config_foreach nut_upsmon_add master primary + config_foreach nut_upsmon_add slave secondary [ ! -s /var/etc/nut/nut.conf ] && { echo "MODE=netclient" >>/var/etc/nut/nut.conf diff --git a/net/nut/files/nut_monitor b/net/nut/files/nut_monitor index c123ba1d3765d..767467ccd3595 100644 --- a/net/nut/files/nut_monitor +++ b/net/nut/files/nut_monitor @@ -83,7 +83,7 @@ # option forcessl 0 # option debugmin 0 -#config master +#config primary # option upsname upsname # option hostname localhost # option port # optional port number @@ -91,7 +91,7 @@ # option username upsuser # option password upspassword -#config slave +#config secondary # option upsname upsname # option hostname localhost # option port # optional port number diff --git a/net/nut/files/nut_server b/net/nut/files/nut_server index cda92497d3a71..98149ee50abda 100644 --- a/net/nut/files/nut_server +++ b/net/nut/files/nut_server @@ -11,7 +11,7 @@ # option password upspassword # option actions optional-action # list instcmd optional-instant-command -# option upsmon slave|master +# option upsmon secondary|primary #config listen_address # option address ::1 From ddd66b017b2a3698d78cca53baeac70ac03ce92e Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Mon, 16 Mar 2026 23:09:54 -0400 Subject: [PATCH 3/3] nut: add myself as maintainer and bump PKG_RELEASE Add myself as maintainer, and bump PKG_RELEASE for this PR series. Signed-off-by: Daniel F. Dickinson --- net/nut/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/nut/Makefile b/net/nut/Makefile index 095ede0812af6..320c961323cf8 100644 --- a/net/nut/Makefile +++ b/net/nut/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nut PKG_VERSION:=2.8.4 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.networkupstools.org/source/2.8/ @@ -18,6 +18,8 @@ PKG_LICENSE:=GPL-2.0-or-later GPL-3.0-or-later GPL-1.0-or-later Artistic-1.0-Per PKG_LICENSE_FILES:=LICENSE-GPL2 LICENSE-GPL3 COPYING PKG_FIXUP:=autoreconf +PKG_MAINTAINER:=Daniel F. Dickinson + PKG_INSTALL:=1 PKG_CONFIG_DEPENDS:= \