add gpu clk

Signed-off-by: Xuhui Zhu <simon.zhu@canonical.com>
pull/3093/head
Xuhui Zhu 2024-08-22 16:42:48 -04:00
parent b9d0932179
commit 56f71cf4ca
No known key found for this signature in database
GPG Key ID: 85B0BCCF760C4490
1 changed files with 10 additions and 1 deletions

View File

@ -44,7 +44,7 @@ var (
hwmonSensorTypes = []string{ hwmonSensorTypes = []string{
"vrm", "beep_enable", "update_interval", "in", "cpu", "fan", "vrm", "beep_enable", "update_interval", "in", "cpu", "fan",
"pwm", "temp", "curr", "power", "energy", "humidity", "pwm", "temp", "curr", "power", "energy", "humidity",
"intrusion", "intrusion", "freq",
} }
) )
@ -354,6 +354,15 @@ func (c *hwMonCollector) updateHwmon(ch chan<- prometheus.Metric, dir string) er
continue continue
} }
if sensorType == "freq" && element == "input" {
if label, ok := sensorData["label"]; ok {
sensorLabel := cleanMetricName(label)
desc := prometheus.NewDesc("node_hwmon_freq_hertz", "Hardware monitor for GPU frequency in MHz", hwmonLabelDesc, nil)
ch <- prometheus.MustNewConstMetric(
desc, prometheus.GaugeValue, parsedValue/1000000.0, append(labels[:len(labels)-1], sensorLabel)...)
}
continue
}
// fallback, just dump the metric as is // fallback, just dump the metric as is
desc := prometheus.NewDesc(name, "Hardware monitor "+sensorType+" element "+element, hwmonLabelDesc, nil) desc := prometheus.NewDesc(name, "Hardware monitor "+sensorType+" element "+element, hwmonLabelDesc, nil)