Skip to content

Commit

Permalink
fixes for #61
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlhansen committed Mar 17, 2024
1 parent ba84c85 commit 46be35f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions internal/collector/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,12 @@ func (client *Client) RefreshSystem(mc *Collector, ch chan<- prometheus.Metric)
ch <- mc.NewSystemPowerOn(resp.PowerState)
ch <- mc.NewSystemHealth(resp.Status.Health)
ch <- mc.NewSystemIndicatorLED(resp.IndicatorLED)
ch <- mc.NewSystemMemorySize(resp.MemorySummary.TotalSystemMemoryGiB * 1073741824)
ch <- mc.NewSystemCpuCount(resp.ProcessorSummary.Count, resp.ProcessorSummary.Model)
if resp.MemorySummary != nil {
ch <- mc.NewSystemMemorySize(resp.MemorySummary.TotalSystemMemoryGiB * 1073741824)
}
if resp.ProcessorSummary != nil {
ch <- mc.NewSystemCpuCount(resp.ProcessorSummary.Count, resp.ProcessorSummary.Model)
}
ch <- mc.NewSystemBiosInfo(resp.BiosVersion)
ch <- mc.NewSystemMachineInfo(resp.Manufacturer, resp.Model, resp.SerialNumber, resp.SKU)

Expand Down
10 changes: 6 additions & 4 deletions internal/collector/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ func (mc *Collector) NewSystemMachineInfo(manufacturer, model, serial, sku strin
mc.SystemMachineInfo,
prometheus.UntypedValue,
1.0,
manufacturer,
model,
serial,
sku,
strings.TrimSpace(manufacturer),
strings.TrimSpace(model),
strings.TrimSpace(serial),
strings.TrimSpace(sku),
)
}

Expand All @@ -123,6 +123,7 @@ func (mc *Collector) NewSensorsFanHealth(id, name, health string) prometheus.Met
health,
)
}

func (mc *Collector) NewSensorsFanSpeed(speed float64, id, name, units string) prometheus.Metric {
return prometheus.MustNewConstMetric(
mc.SensorsFanSpeed,
Expand All @@ -144,6 +145,7 @@ func (mc *Collector) NewPowerSupplyHealth(health, id string) prometheus.Metric {
health,
)
}

func (mc *Collector) NewPowerSupplyInputWatts(value float64, id string) prometheus.Metric {
return prometheus.MustNewConstMetric(
mc.PowerSupplyInputWatts,
Expand Down

0 comments on commit 46be35f

Please sign in to comment.