Connection State Checking and Base Image Upgrade #8

Merged
boray-tw merged 3 commits from main into main 2025-08-13 11:33:07 -04:00
boray-tw commented 2025-08-12 10:34:42 -04:00 (Migrated from github.com)

Expected Results

  1. By script/init.sh, the UPS should be connected in 2 seconds after /etc/init.d/pwrstatd launches a daemon. And pwrstat command runs fine.
  2. The base image has a concrete tag for reproduceable builds.

Actual Results

  1. The UPS may not be connected in 2 seconds; e.g., sometimes 60 seconds in my setup. So, the following pwrstat commands silently fail, and pwrstat-exporter panics.
  2. The base image tag only specifies the major Debian version.

Container Logs

::Starting pwrstatd 1.4.1.
Info::
 Address: http://localhost:8088/metrics
panic: pwrstat missing

goroutine 40 [running]:
main.(*PwrstatCollector).Collect(0xbffce0, 0xc000226480)
  /app/main.go:79 +0x1285
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
  /app/vendor/github.com/prometheus/client_golang/prometheus/registry.go:446 +0x12b
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
  /app/vendor/github.com/prometheus/client_golang/prometheus/registry.go:457 +0x5ce

Analysis and Solution

  1. /etc/init.d/pwrstatd launches /usr/sbin/pwrstatd as a daemon and stores its PID in /var/run/pwrstatd/pwrstatd.pid.
  2. By observation, such daemon process turns from running state to sleeping if it connects to a UPS (and it beeps). So, we can check the connection via the daemon state.
  3. (Additional information) During connection initilization, pwrstat gives "No such file or directory" for non-help commands, and pwrstat-exporter panics.

Environment

  • Operating system: Debian 13
  • Linux kernel and architecture: 6.12.38-1 (2025-07-16) x86_64
  • Prometheus: v3.5.0

Notes

  1. 72b9668 cleans up the powerpanel installer to slim the image size.
  2. debian:trixie-slim image does not ship with /etc/init.d. A manual directory creation can resolve errors during powerpanel installation, and everything works fine later on.
## Expected Results 1. By `script/init.sh`, the UPS should be connected in 2 seconds after `/etc/init.d/pwrstatd` launches a daemon. And `pwrstat` command runs fine. 2. The base image has a concrete tag for reproduceable builds. ## Actual Results 1. The UPS may not be connected in 2 seconds; e.g., sometimes 60 seconds in my setup. So, the following `pwrstat` commands silently fail, and `pwrstat-exporter` panics. 2. The base image tag only specifies the major Debian version. ## Container Logs ::Starting pwrstatd 1.4.1. Info:: Address: http://localhost:8088/metrics panic: pwrstat missing goroutine 40 [running]: main.(*PwrstatCollector).Collect(0xbffce0, 0xc000226480) /app/main.go:79 +0x1285 github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1() /app/vendor/github.com/prometheus/client_golang/prometheus/registry.go:446 +0x12b created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather /app/vendor/github.com/prometheus/client_golang/prometheus/registry.go:457 +0x5ce ## Analysis and Solution 1. `/etc/init.d/pwrstatd` launches `/usr/sbin/pwrstatd` as a daemon and stores its PID in `/var/run/pwrstatd/pwrstatd.pid`. 2. By observation, such daemon process turns from running state to sleeping if it connects to a UPS (and it beeps). So, we can check the connection via the daemon state. 3. (Additional information) During connection initilization, `pwrstat` gives "No such file or directory" for non-help commands, and `pwrstat-exporter` panics. ## Environment * Operating system: Debian 13 * Linux kernel and architecture: 6.12.38-1 (2025-07-16) x86_64 * Prometheus: v3.5.0 ## Notes 1. 72b9668 cleans up the powerpanel installer to slim the image size. 2. `debian:trixie-slim` image does not ship with `/etc/init.d`. A manual directory creation can resolve errors during powerpanel installation, and everything works fine later on.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
maxpeterkaya/pwrstat-exporter!8
No description provided.