Skip to content

Commit

Permalink
remove ipmi ip metric
Browse files Browse the repository at this point in the history
currently too unreliable to be useful
  • Loading branch information
mwennrich committed Oct 8, 2024
1 parent abbd956 commit b67d705
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 47 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,23 @@ metal_switch_sync_failed{partition="fra-equ01",rackid="fra-equ01-rack01",switchn
# TYPE metal_machine_hardware_info gauge
metal_machine_hardware_info{size="c1-xlarge-x86",biosVersion="3.4",bmcVersion="1.73",boardMfg="Supermicro",boardMfgSerial="",boardPartNumber="X11DPT-B",chassisPartNumber="CSE-217BHQ+-R2K22BP2",chassisPartSerial="C217BAH24AE0006",machineid="11111111-2222-3333-4444-aabbccddeeff",partition="fra-equ01",productManufacturer="Supermicro",productPartNumber="SYS-2029BT-HNR",productSerial="E262335X9100766D"} 1
# HELP metal_machine_ipmi_info Provide the ipmi ip address
# TYPE metal_machine_ipmi_info gauge
metal_machine_ipmi_info{ipmiIP="10.1.1.36:623",machineid="11111111-2222-3333-4444-aabbccddeeff"} 1
# HELP metal_machine_info Provide the ipmi ip address
# TYPE metal_machine_info gauge
metal_machine_info{ipmiIP="10.1.1.36:623",machineid="11111111-2222-3333-4444-aabbccddeeff"} 1
# HELP metal_machine_ipmi_power_state Provide information about the machine power state
# TYPE metal_machine_ipmi_power_state gauge
metal_machine_ipmi_power_state{machineid="11111111-2222-3333-4444-aabbccddeeff"} 1
# HELP metal_machine_power_state Provide information about the machine power state
# TYPE metal_machine_power_state gauge
metal_machine_power_state{machineid="11111111-2222-3333-4444-aabbccddeeff"} 1
# HELP metal_machine_ipmi_power_supplies_healthy Provide information about the number of healthy power supplies
# TYPE metal_machine_ipmi_power_supplies_healthy gauge
metal_machine_ipmi_power_supplies_healthy{machineid="11111111-2222-3333-4444-aabbccddeeff"} 2
# HELP metal_machine_power_supplies_healthy Provide information about the number of healthy power supplies
# TYPE metal_machine_power_supplies_healthy gauge
metal_machine_power_supplies_healthy{machineid="11111111-2222-3333-4444-aabbccddeeff"} 2
# HELP metal_machine_ipmi_power_supplies_total Provide information about the total number of power supplies
# TYPE metal_machine_ipmi_power_supplies_total gauge
metal_machine_ipmi_power_supplies_total{machineid="11111111-2222-3333-4444-aabbccddeeff"} 2
# HELP metal_machine_power_supplies_total Provide information about the total number of power supplies
# TYPE metal_machine_power_supplies_total gauge
metal_machine_power_supplies_total{machineid="11111111-2222-3333-4444-aabbccddeeff"} 2
# HELP metal_machine_ipmi_power_usage Provide information about the machine power usage in watts
# TYPE metal_machine_ipmi_power_usage gauge
metal_machine_ipmi_power_usage{machineid="11111111-2222-3333-4444-aabbccddeeff"} 69
# HELP metal_machine_power_usage Provide information about the machine power usage in watts
# TYPE metal_machine_power_usage gauge
metal_machine_power_usage{machineid="11111111-2222-3333-4444-aabbccddeeff"} 69
```
32 changes: 0 additions & 32 deletions metalCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ type metalCollector struct {
machineIssues *prometheus.Desc
machineIssuesInfo *prometheus.Desc

machineIpmiIpAddress *prometheus.Desc
machineIpmiLastUpdated *prometheus.Desc
machinePowerUsage *prometheus.Desc
machinePowerState *prometheus.Desc
machinePowerSuppliesTotal *prometheus.Desc
Expand Down Expand Up @@ -189,16 +187,6 @@ func newMetalCollector(client metalgo.Client) *metalCollector {
"Provide information on machine issues",
[]string{"machineid", "issueid"}, nil,
),
machineIpmiIpAddress: prometheus.NewDesc(
"metal_machine_ipmi_address",
"Provide the ipmi ip address",
[]string{"machineid", "ipmiIP"}, nil,
),
machineIpmiLastUpdated: prometheus.NewDesc(
"metal_machine_last_updated",
"Provide the timestamp of the last ipmi update",
[]string{"machineid"}, nil,
),
machinePowerUsage: prometheus.NewDesc(
"metal_machine_power_usage",
"Provide information about the machine power usage in watts",
Expand Down Expand Up @@ -261,8 +249,6 @@ func (collector *metalCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- collector.machineAllocationInfo
ch <- collector.machineIssues
ch <- collector.machineIssuesInfo
ch <- collector.machineIpmiIpAddress
ch <- collector.machineIpmiLastUpdated
ch <- collector.machinePowerUsage
ch <- collector.machinePowerState
ch <- collector.machinePowerSuppliesTotal
Expand Down Expand Up @@ -426,9 +412,6 @@ func (collector *metalCollector) Collect(ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(collector.machineIssuesInfo, prometheus.GaugeValue, 1.0, *issue.ID, pointer.SafeDeref(issue.Description), pointer.SafeDeref(issue.Severity), pointer.SafeDeref(issue.RefURL))
}

ipmiIpMachineIds := map[string]string{}
ipmiIpLastUpdates := map[string]time.Time{}

for _, m := range machines.Payload {
m := m

Expand Down Expand Up @@ -493,17 +476,6 @@ func (collector *metalCollector) Collect(ch chan<- prometheus.Metric) {
}
ch <- prometheus.MustNewConstMetric(collector.machinePowerSuppliesHealthy, prometheus.GaugeValue, float64(healthy), *m.ID)
}
if m.Ipmi.LastUpdated != nil {
lu := time.Time(*m.Ipmi.LastUpdated)
ch <- prometheus.MustNewConstMetric(collector.machineIpmiLastUpdated, prometheus.GaugeValue, float64(lu.Unix()), *m.ID)
if m.Ipmi.Address != nil {
// only store the latest ip address to prevent duplicate ipmiIP labels
if t, ok := ipmiIpLastUpdates[*m.Ipmi.Address]; !ok || lu.After(t) {
ipmiIpLastUpdates[*m.Ipmi.Address] = lu
ipmiIpMachineIds[*m.Ipmi.Address] = *m.ID
}
}
}
if m.Ipmi.Powermetric != nil && m.Ipmi.Powermetric.Averageconsumedwatts != nil {
ch <- prometheus.MustNewConstMetric(collector.machinePowerUsage, prometheus.GaugeValue, float64(pointer.SafeDeref(m.Ipmi.Powermetric.Averageconsumedwatts)), *m.ID)
}
Expand Down Expand Up @@ -534,10 +506,6 @@ func (collector *metalCollector) Collect(ch chan<- prometheus.Metric) {
}
}

for ip, mId := range ipmiIpMachineIds {
ch <- prometheus.MustNewConstMetric(collector.machineIpmiIpAddress, prometheus.GaugeValue, 1.0, mId, ip)
}

projects, err := collector.client.Project().ListProjects(project.NewListProjectsParams(), nil)
if err != nil {
panic(err)
Expand Down

0 comments on commit b67d705

Please sign in to comment.