Skip to content

Commit

Permalink
add gpu clk
Browse files Browse the repository at this point in the history
Signed-off-by: Xuhui Zhu <simon.zhu@canonical.com>
  • Loading branch information
zxhdaze committed Aug 22, 2024
1 parent b9d0932 commit 503fde8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion collector/hwmon_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
hwmonSensorTypes = []string{
"vrm", "beep_enable", "update_interval", "in", "cpu", "fan",
"pwm", "temp", "curr", "power", "energy", "humidity",
"intrusion",
"intrusion", "freq",
}
)

Expand Down Expand Up @@ -354,6 +354,15 @@ func (c *hwMonCollector) updateHwmon(ch chan<- prometheus.Metric, dir string) er
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

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

0 comments on commit 503fde8

Please sign in to comment.