ungleich-ups: bump to 0.2.2

This commit is contained in:
Nico Schottelius 2026-09-16 09:48:41 +02:00
commit 4c0ef3a614
6 changed files with 68 additions and 9 deletions

View file

@ -0,0 +1,19 @@
FROM alpine:3.24
RUN apk add -U nut
# Bug: https://gitlab.alpinelinux.org/alpine/aports/-/work_items/18437
RUN ln -s /usr/lib/libusb-1.0.so.0.6.0 /usr/lib/libusb-1.0.so.0.5.0
# Allow a prometheus plugin to connect to it
RUN sed -i 's/MODE=none/MODE=netserver/' /etc/nut/nut.conf
# Only listen on localhost, but need ipv4 for nut_exporter
RUN echo LISTEN ::1 3493 >> /etc/nut/upsd.conf
# Needed by upsd
RUN mkdir -p /var/run/nut
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -0,0 +1 @@
Dockerfile_0.2.0

View file

@ -0,0 +1,20 @@
FROM alpine:3.24
RUN apk add -U nut
# Bug: https://gitlab.alpinelinux.org/alpine/aports/-/work_items/18437
RUN ln -s /usr/lib/libusb-1.0.so.0.6.0 /usr/lib/libusb-1.0.so.0.5.0
# Allow a prometheus plugin to connect to it
RUN sed -i 's/MODE=none/MODE=netserver/' /etc/nut/nut.conf
# Only listen on localhost, but need ipv4 for nut_exporter
RUN echo LISTEN ::1 3493 >> /etc/nut/upsd.conf
RUN echo LISTEN 127.0.0.1 3493 >> /etc/nut/upsd.conf
# Needed by upsd
RUN mkdir -p /var/run/nut
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -11,6 +11,13 @@
- hon95/prometheus-nut-exporter:1
- port 9995
- last image 4 years ago
* 0.2.2, 2026-09-16
* 0.2.1, 2026-09-16
- Reduce regular logging output
* 0.2.0, 2026-09-16
- Start upsd
- Fix run directory creation
- Fix driver running
* 0.1.2, 2026-09-10
- Remove openrc, start nut directly (openrc does not exist by
default anyway)

View file

@ -23,13 +23,13 @@ spec:
operator: Exists
effect: NoSchedule
containers:
- name: ungleich-ups
image: harbor.k8s.ungleich.ch/ungleich-public/ungleich-ups:0.1.2
- name: nut
image: harbor.k8s.ungleich.ch/ungleich-public/ungleich-ups:0.2.1
securityContext:
privileged: true
volumeMounts:
- name: usb-devices
mountPath: /dev/bus/usb
# - name: usb-devices
# mountPath: /dev/bus/usb
- name: dev
mountPath: /dev
- name: nut-exporter
@ -38,9 +38,9 @@ spec:
- name: http
containerPort: 9199
volumes:
- name: usb-devices
hostPath:
path: /dev/bus/usb
# - name: usb-devices
# hostPath:
# path: /dev/bus/usb
- name: dev
hostPath:
path: /dev

View file

@ -4,12 +4,24 @@
# scan for ups & log to stdout
nut-scanner -UUU 2>/dev/null | tee /etc/nut/ups.conf
/usr/sbin/upsdrvctl start
# Start drivers
/usr/sbin/upsdrvctl -u root start
# Start upsd
/usr/sbin/upsd
# one time full detail
ups_list=$(upsc -l 2>/dev/null)
for ups in $ups_list; do
upsc $ups
done
# Afterwards only minimal log
while true; do
ups_list=$(upsc -l 2>/dev/null)
for ups in $ups_list; do
upsc $ups
echo ${ups}:
upsc $ups | grep -e ^ups.status -e ^input.voltage -e ^ups.load
done
sleep 60
done