diff --git a/internal/metrics/sensors.go b/internal/metrics/sensors.go index 4a69c54..eadd533 100644 --- a/internal/metrics/sensors.go +++ b/internal/metrics/sensors.go @@ -142,8 +142,14 @@ func flatten(s Sample, want func(id string) bool) []sensors.Sensor { f.add(p+".used_pct", x.Mount+" used", "usage", "%", ratio(x.Used, x.Size), s.fsT, pct, lbl...) } + gpuSeen := map[string]int{} for _, g := range s.GPUs { + // two identical cards are gpu. and gpu._2, every sensor of the second under + // its own stem (not add's suffix on the end of each id, which the page can't find) p := "gpu." + sensors.Seg(g.Name) + if gpuSeen[p]++; gpuSeen[p] > 1 { + p = fmt.Sprintf("%s_%d", p, gpuSeen[p]) + } lbl := []string{"name", g.Name, "driver", g.Driver} if g.Bus != "" { lbl = append(lbl, "bus", g.Bus)