Skip to content

Commit 23cd688

Browse files
committed
Issue #67 healthcheck improvements, add MAXAGE variable
1 parent 6a31ab4 commit 23cd688

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

images/nut-upsd/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ENV API_USER=upsmon \
1313
DESCRIPTION=UPS \
1414
DRIVER=usbhid-ups \
1515
GROUP=nut \
16+
MAXAGE=15 \
1617
NAME=ups \
1718
POLLINTERVAL= \
1819
PORT=auto \
@@ -22,7 +23,8 @@ ENV API_USER=upsmon \
2223
SERVER=master \
2324
USER=nut \
2425
VENDORID=
25-
HEALTHCHECK CMD upsc $NAME@localhost:3493 2>&1|grep -q stale && exit 1 || true
26+
HEALTHCHECK CMD upsc $NAME@localhost:3493 2>&1|grep -q stale && \
27+
kill -SIGTERM -1 || true
2628

2729
RUN apk add --update nut=$NUT_VERSION \
2830
libcrypto3 libssl3 libusb musl net-snmp-libs

images/nut-upsd/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This will expose TCP port 3493; to reach it with the standard Nagios plugin, set
1717

1818
As a read-only service intended for monitoring, this container makes no attempt to lock down network security.
1919

20-
Verified with the most-common type of UPS, the APC consumer-grade product; Tripp Lite models also (probably) work. Note that the usbhid-ups driver for APC requires you to provide the correct 12-digit hardware serial number. All other parameter defaults will work.
20+
Verified with the most-common type of UPS, the APC consumer-grade product; Tripp Lite models also (probably) work. CyberPower models need a MAXAGE parameter set longer than default (25). Note that the usbhid-ups driver for APC requires you to provide the correct 12-digit hardware serial number. All other parameter defaults will work.
2121

2222
If you have a different model of UPS, contents of the files ups.conf, upsd.conf, upsmon.conf, and/or upsd.users can be overridden by mounting them to /etc/nut/local.
2323

@@ -43,6 +43,7 @@ API_PASSWORD | | API password, if not using secret
4343
DESCRIPTION | UPS | user-assigned description
4444
DRIVER | usbhid-ups | driver (see [compatibility list](http://networkupstools.org/stable-hcl.html))
4545
GROUP | nut | local group
46+
MAXAGE | 15 | seconds before declaring driver non-responsive
4647
NAME | ups | user-assigned config name
4748
POLLINTERVAL | | Poll Interval for ups.conf
4849
PORT | auto | device port (e.g. /dev/ttyUSB0) on host

images/nut-upsd/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ EOF
3030
echo " sdorder = $SDORDER" >> /etc/nut/ups.conf
3131
fi
3232
fi
33+
if [ "$MAXAGE" -ne 15 ]; then
34+
sed -i -e "s/^[# ]*MAXAGE [0-9]\+/MAXAGE $MAXAGE/" /etc/nut/upsd.conf
35+
fi
3336
if [ -e /etc/nut/local/upsd.conf ]; then
3437
cp /etc/nut/local/upsd.conf /etc/nut/upsd.conf
3538
else

images/nut-upsd/helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sources:
66
- https://github.com/instantlinux/docker-tools
77
- https://github.com/networkupstools/nut
88
type: application
9-
version: 0.1.5
9+
version: 0.1.6
1010
appVersion: "2.8.1-r0"
1111
dependencies:
1212
- name: chartlib

images/nut-upsd/helm/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Default values for nut-upsd.
22
deployment:
33
env:
4+
driver: usbhid-ups
5+
maxage: 15
46
serial: mustbeset
57
securityContext:
68
privileged: true

0 commit comments

Comments
 (0)