Skip to content

fix: export generic PSU metrics#36

Merged
rokernel merged 2 commits into
masterfrom
fix/psu-generic-metrics
Jun 4, 2026
Merged

fix: export generic PSU metrics#36
rokernel merged 2 commits into
masterfrom
fix/psu-generic-metrics

Conversation

@rokernel
Copy link
Copy Markdown
Owner

@rokernel rokernel commented Jun 4, 2026

Summary

  • replace old PSU input/output numeric metrics with generic PSU voltage/current/power metrics
  • skip missing, empty, N/A, and malformed PSU numeric values instead of exporting fake zeroes
  • add Grafana dashboard, dashboard validation script, and docs updates for the new metric families

Testing

  • ./scripts/validate-dashboard.sh dashboards/sonic-exporter.json
  • go test ./internal/collector -run 'TestHwCollector|TestHwCollectorMetricFilter|TestHwCollectorPsuNumericMetricParsing' -count=1
  • go test ./...
  • go build ./...

Live validation

  • Deployed an archive build to one SONiC switch that exposes generic PSU Redis fields
  • Verified live metrics:
    • sonic_hw_psu_voltage_volts{slot="1"} 12.1
    • sonic_hw_psu_voltage_volts{slot="2"} 12.1
    • sonic_hw_psu_current_amperes{slot="1"} 19.968
    • sonic_hw_psu_current_amperes{slot="2"} 17.312
    • sonic_hw_psu_power_watts{slot="1"} 242
    • sonic_hw_psu_power_watts{slot="2"} 210
  • sonic_hw_collector_success 1

Notes

  • Validated on a second SONiC switch that did not expose usable generic PSU numeric fields; in that case the collector skipped the numeric metrics instead of exporting incorrect zeroes.
  • After merge, the normal upstream release flow appears to be: annotate and push v0.1.2, then deploy the published GHCR image.

@rokernel rokernel merged commit e7220e4 into master Jun 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant