-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.go
129 lines (109 loc) · 4.01 KB
/
stats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package main
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
promNamespace = "radeon_exporter"
fanInput = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "fan1_input",
Help: "fan speed in RPM",
}, []string{"card_id"})
fanMax = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "fan1_max",
Help: "a maximum value Unit: revolution/max (RPM)",
}, []string{"card_id"})
computeFreq = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "freq1_input",
Help: "the gfx/compute clock in hertz",
}, []string{"card_id"})
memFreq = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "freq2_input",
Help: "the memory clock in hertz",
}, []string{"card_id"})
dieTemp = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "temp1_input",
Help: "the on die GPU temperature in millidegrees Celsius",
}, []string{"card_id"})
vddgfx = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "in0_input",
Help: "the vddgfx voltage in millivolts",
}, []string{"card_id"})
vddnb = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "in1_input",
Help: "the vddnb voltage in millivolts",
}, []string{"card_id"})
ppt = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "power1_input",
Help: "the ppt voltage in microvolts",
}, []string{"card_id"})
/////////////////////////////// start device/*
gpuBusy = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "gpu_busy_percent",
Help: "how busy the GPU is as a percentage",
}, []string{"card_id"})
memBusy = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "mem_busy_percent",
Help: "how busy the VRAM is as a percentage",
}, []string{"card_id"})
gttTotal = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "mem_info_gtt_total",
Help: "total size of the GTT block, in bytes",
}, []string{"card_id"})
gttUsed = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "mem_info_gtt_used",
Help: "current used size of the GTT block, in bytes",
}, []string{"card_id"})
visibleVRAMTotal = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "mem_info_vis_vram_total",
Help: "total amount of visible VRAM in bytes",
}, []string{"card_id"})
visibleVRAMUsed = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "mem_info_vis_vram_used",
Help: "currently used visible VRAM in bytes",
}, []string{"card_id"})
totalVRAM = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "mem_info_vram_total",
Help: "total amount of VRAM in bytes",
}, []string{"card_id"})
usedVRAM = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "mem_info_vram_used",
Help: "currently used VRAM in bytes",
}, []string{"card_id"})
// statMap maps filename to prom stat
statMap = map[string]*prometheus.GaugeVec{
"fan1_input": fanInput,
"fan1_max": fanMax,
"freq1_input": computeFreq,
"freq2_input": memFreq,
"temp1_input": dieTemp,
"in0_input": vddgfx,
"in1_input": vddnb,
"power1_input": ppt,
"device/gpu_busy_percent": gpuBusy,
"device/mem_busy_percent": memBusy,
// "device/current_link_speed": memBusy, HANDLE string vals
"device/mem_info_gtt_total": gttTotal,
"device/mem_info_gtt_used": gttUsed,
"device/mem_info_vis_vram_total": visibleVRAMTotal,
"device/mem_info_vis_vram_used": visibleVRAMUsed,
"device/mem_info_vram_total": totalVRAM,
"device/mem_info_vram_used": usedVRAM,
}
)