From b67d70540167e388e932e78b9d4293fd4b6cfe28 Mon Sep 17 00:00:00 2001 From: Markus Wennrich Date: Tue, 8 Oct 2024 09:58:13 +0200 Subject: [PATCH] remove ipmi ip metric currently too unreliable to be useful --- README.md | 30 +++++++++++++++--------------- metalCollector.go | 32 -------------------------------- 2 files changed, 15 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 38514a5..6f3eb6e 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/metalCollector.go b/metalCollector.go index 175cd74..2fc65b9 100644 --- a/metalCollector.go +++ b/metalCollector.go @@ -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 @@ -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", @@ -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 @@ -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 @@ -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) } @@ -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)