Skip to content

Commit 2070ccf

Browse files
committed
add gpu clk
1 parent b9d0932 commit 2070ccf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

collector/hwmon_linux.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var (
4444
hwmonSensorTypes = []string{
4545
"vrm", "beep_enable", "update_interval", "in", "cpu", "fan",
4646
"pwm", "temp", "curr", "power", "energy", "humidity",
47-
"intrusion",
47+
"intrusion", "freq",
4848
}
4949
)
5050

@@ -354,6 +354,15 @@ func (c *hwMonCollector) updateHwmon(ch chan<- prometheus.Metric, dir string) er
354354
continue
355355
}
356356

357+
if sensorType == "freq" && element == "input" {
358+
if label, ok := sensorData["label"]; ok {
359+
sensorLabel := cleanMetricName(label)
360+
desc := prometheus.NewDesc("node_hwmon_freq_hertz", "Hardware monitor for GPU frequency in MHz", hwmonLabelDesc, nil)
361+
ch <- prometheus.MustNewConstMetric(
362+
desc, prometheus.GaugeValue, parsedValue/1000000.0, append(labels[:len(labels)-1], sensorLabel)...)
363+
}
364+
continue
365+
}
357366
// fallback, just dump the metric as is
358367

359368
desc := prometheus.NewDesc(name, "Hardware monitor "+sensorType+" element "+element, hwmonLabelDesc, nil)

0 commit comments

Comments
 (0)