Skip to content

Commit

Permalink
Make sure descPDU handles the power outlets.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepj committed Sep 11, 2023
1 parent 5514be1 commit ce55a86
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/promunifi/pdu.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type pdu struct {
}

func descPDU(ns string) *pdu {
outlet := ns + "outlet_"
pns := ns + "port_"
sfp := pns + "sfp_"
labelS := []string{"site_name", "name", "source"}
Expand All @@ -69,6 +70,9 @@ func descPDU(ns string) *pdu {
"sfp_part", "sfp_vendor", "sfp_serial", "sfp_compliance",
"port_id", "port_num", "port_name", "port_mac", "port_ip", "site_name", "name", "source",
}
labelO := []string{
"outlet_description", "outlet_index", "outlet_name", "site_name", "name", "source",
}
nd := prometheus.NewDesc

return &pdu{
Expand Down Expand Up @@ -116,6 +120,14 @@ func descPDU(ns string) *pdu {
SFPVoltage: nd(sfp+"voltage", "SFP Voltage", labelF, nil),
// other data
Upgradeable: nd(ns+"upgradeable", "Upgrade-able", labelS, nil),
// power
CycleEnabled: nd(outlet+"cycle_enabled", "Cycle Enabled", labelO, nil),
RelayState: nd(outlet+"relay_state", "Relay State", labelO, nil),
OutletCaps: nd(outlet+"outlet_caps", "Outlet Caps", labelO, nil),
OutletCurrent: nd(outlet+"outlet_current", "Outlet Current", labelO, nil),
OutletPower: nd(outlet+"outlet_power", "Outlet Power", labelO, nil),
OutletPowerFactor: nd(outlet+"outlet_power_factor", "Outlet Power Factor", labelO, nil),
OutletVoltage: nd(outlet+"outlet_voltage", "Outlet Voltage", labelO, nil),
}
}

Expand Down

0 comments on commit ce55a86

Please sign in to comment.