Skip to content

Commit 3205596

Browse files
committed
New metric name standard
Signed-off-by: Örnfeldt Philip (66140321) <philip.ornfeldt@forsakringskassan.se>
1 parent 7ae2f70 commit 3205596

3 files changed

Lines changed: 468 additions & 120 deletions

File tree

pkg/probe/system_performance_status.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,72 +24,72 @@ import (
2424
func probeSystemPerformanceStatus(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
2525
var (
2626
cpuCoresUser = prometheus.NewDesc(
27-
"fortigate_system_performance_status_cpu_cores_user",
27+
"fortigate_system_performance_status_cpu_cores_user_ratio",
2828
"Percentage of CPU utilization that occurred at the user level.",
2929
[]string{"label", "vdom"}, nil,
3030
)
3131
cpuCoresSystem = prometheus.NewDesc(
32-
"fortigate_system_performance_status_cpu_cores_system",
32+
"fortigate_system_performance_status_cpu_cores_system_ratio",
3333
"Percentage of CPU utilization that occurred while executing at the system level.",
3434
[]string{"label", "vdom"}, nil,
3535
)
3636
cpuCoresNice = prometheus.NewDesc(
37-
"fortigate_system_performance_status_cpu_cores_nice",
37+
"fortigate_system_performance_status_cpu_cores_nice_ratio",
3838
"Percentage of CPU utilization that occurred while executing at the user level with nice priority.",
3939
[]string{"label", "vdom"}, nil,
4040
)
4141
cpuCoresIdle = prometheus.NewDesc(
42-
"fortigate_system_performance_status_cpu_cores_idle",
42+
"fortigate_system_performance_status_cpu_cores_idle_ratio",
4343
"Percentage of time that the CPU was idle and the system did not have an outstanding disk I/O request.",
4444
[]string{"label", "vdom"}, nil,
4545
)
4646
cpuCoresIowait = prometheus.NewDesc(
47-
"fortigate_system_performance_status_cpu_cores_iowait",
47+
"fortigate_system_performance_status_cpu_cores_iowait_ratio",
4848
"Percentage of time that the CPU was idle during which the system had an outstanding disk I/O request.",
4949
[]string{"label", "vdom"}, nil,
5050
)
5151
cpuUser = prometheus.NewDesc(
52-
"fortigate_system_performance_status_cpu_user",
52+
"fortigate_system_performance_status_cpu_user_ratio",
5353
"Percentage of CPU utilization that occurred at the user level.",
5454
[]string{"vdom"}, nil,
5555
)
5656
cpuSystem = prometheus.NewDesc(
57-
"fortigate_system_performance_status_cpu_system",
57+
"fortigate_system_performance_status_cpu_system_ratio",
5858
"Percentage of CPU utilization that occurred while executing at the system level.",
5959
[]string{"vdom"}, nil,
6060
)
6161
cpuNice = prometheus.NewDesc(
62-
"fortigate_system_performance_status_cpu_nice",
62+
"fortigate_system_performance_status_cpu_nice_ratio",
6363
"Percentage of CPU utilization that occurred while executing at the user level with nice priority.",
6464
[]string{"vdom"}, nil,
6565
)
6666
cpuIdle = prometheus.NewDesc(
67-
"fortigate_system_performance_status_cpu_idle",
67+
"fortigate_system_performance_status_cpu_idle_ratio",
6868
"Percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.",
6969
[]string{"vdom"}, nil,
7070
)
7171
cpuIowait = prometheus.NewDesc(
72-
"fortigate_system_performance_status_cpu_iowait",
72+
"fortigate_system_performance_status_cpu_iowait_ratio",
7373
"Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.",
7474
[]string{"vdom"}, nil,
7575
)
7676
memTotal = prometheus.NewDesc(
77-
"fortigate_system_performance_status_mem_total",
77+
"fortigate_system_performance_status_mem_bytes_total",
7878
"All the installed memory in RAM, in bytes.",
7979
[]string{"vdom"}, nil,
8080
)
8181
memUsed = prometheus.NewDesc(
82-
"fortigate_system_performance_status_mem_used",
82+
"fortigate_system_performance_status_mem_used_bytes",
8383
"Memory are being used, in bytes.",
8484
[]string{"vdom"}, nil,
8585
)
8686
memFree = prometheus.NewDesc(
87-
"fortigate_system_performance_status_mem_free",
87+
"fortigate_system_performance_status_mem_free_bytes",
8888
"All the memory in RAM that is not being used for anything (even caches), in bytes.",
8989
[]string{"vdom"}, nil,
9090
)
9191
memFreeable = prometheus.NewDesc(
92-
"fortigate_system_performance_status_mem_freeable",
92+
"fortigate_system_performance_status_mem_freeable_bytes",
9393
"Freeable buffers/caches memory, in bytes.",
9494
[]string{"vdom"}, nil,
9595
)
@@ -138,17 +138,17 @@ func probeSystemPerformanceStatus(c http.FortiHTTP, meta *TargetMetadata) ([]pro
138138
var core_num string
139139
for i, core := range res.Results.Cpu.Cores {
140140
core_num = "core_" + strconv.Itoa(i)
141-
m = append(m, prometheus.MustNewConstMetric(cpuCoresUser, prometheus.GaugeValue, float64(core.User), core_num, res.VDOM))
142-
m = append(m, prometheus.MustNewConstMetric(cpuCoresSystem, prometheus.GaugeValue, float64(core.System), core_num, res.VDOM))
143-
m = append(m, prometheus.MustNewConstMetric(cpuCoresNice, prometheus.GaugeValue, float64(core.Nice), core_num, res.VDOM))
144-
m = append(m, prometheus.MustNewConstMetric(cpuCoresIdle, prometheus.GaugeValue, float64(core.Idle), core_num, res.VDOM))
145-
m = append(m, prometheus.MustNewConstMetric(cpuCoresIowait, prometheus.GaugeValue, float64(core.Iowait), core_num, res.VDOM))
141+
m = append(m, prometheus.MustNewConstMetric(cpuCoresUser, prometheus.GaugeValue, float64(core.User) * 0.01, core_num, res.VDOM))
142+
m = append(m, prometheus.MustNewConstMetric(cpuCoresSystem, prometheus.GaugeValue, float64(core.System) * 0.01, core_num, res.VDOM))
143+
m = append(m, prometheus.MustNewConstMetric(cpuCoresNice, prometheus.GaugeValue, float64(core.Nice) * 0.01, core_num, res.VDOM))
144+
m = append(m, prometheus.MustNewConstMetric(cpuCoresIdle, prometheus.GaugeValue, float64(core.Idle) * 0.01, core_num, res.VDOM))
145+
m = append(m, prometheus.MustNewConstMetric(cpuCoresIowait, prometheus.GaugeValue, float64(core.Iowait) * 0.01, core_num, res.VDOM))
146146
}
147-
m = append(m, prometheus.MustNewConstMetric(cpuUser,prometheus.GaugeValue, float64(res.Results.Cpu.User), res.VDOM))
148-
m = append(m, prometheus.MustNewConstMetric(cpuSystem,prometheus.GaugeValue, float64(res.Results.Cpu.System), res.VDOM))
149-
m = append(m, prometheus.MustNewConstMetric(cpuNice,prometheus.GaugeValue, float64(res.Results.Cpu.Nice), res.VDOM))
150-
m = append(m, prometheus.MustNewConstMetric(cpuIdle,prometheus.GaugeValue, float64(res.Results.Cpu.Idle), res.VDOM))
151-
m = append(m, prometheus.MustNewConstMetric(cpuIowait,prometheus.GaugeValue, float64(res.Results.Cpu.Iowait), res.VDOM))
147+
m = append(m, prometheus.MustNewConstMetric(cpuUser,prometheus.GaugeValue, float64(res.Results.Cpu.User) * 0.01, res.VDOM))
148+
m = append(m, prometheus.MustNewConstMetric(cpuSystem,prometheus.GaugeValue, float64(res.Results.Cpu.System) * 0.01, res.VDOM))
149+
m = append(m, prometheus.MustNewConstMetric(cpuNice,prometheus.GaugeValue, float64(res.Results.Cpu.Nice) * 0.01, res.VDOM))
150+
m = append(m, prometheus.MustNewConstMetric(cpuIdle,prometheus.GaugeValue, float64(res.Results.Cpu.Idle) * 0.01, res.VDOM))
151+
m = append(m, prometheus.MustNewConstMetric(cpuIowait,prometheus.GaugeValue, float64(res.Results.Cpu.Iowait) * 0.01, res.VDOM))
152152
m = append(m, prometheus.MustNewConstMetric(memTotal,prometheus.GaugeValue, float64(res.Results.Mem.Total), res.VDOM))
153153
m = append(m, prometheus.MustNewConstMetric(memUsed,prometheus.GaugeValue, float64(res.Results.Mem.Used), res.VDOM))
154154
m = append(m, prometheus.MustNewConstMetric(memFree,prometheus.GaugeValue, float64(res.Results.Mem.Free), res.VDOM))

0 commit comments

Comments
 (0)