mirror of
https://github.com/netdata/netdata.git
synced 2025-04-09 15:47:53 +00:00
go.d prometheus fix units for snmp_exporter (#17524)
This commit is contained in:
parent
63ec0d89dd
commit
f91e91bb71
1 changed files with 15 additions and 0 deletions
|
@ -280,6 +280,21 @@ func getChartUnits(metric string) string {
|
|||
|
||||
idx := strings.LastIndexByte(metric, '_')
|
||||
if idx == -1 {
|
||||
// snmp_exporter: e.g. ifOutUcastPkts, ifOutOctets.
|
||||
if idx = strings.LastIndexFunc(metric, func(r rune) bool { return r >= 'A' && r <= 'Z' }); idx != -1 {
|
||||
v := strings.ToLower(metric[idx:])
|
||||
switch v {
|
||||
case "pkts":
|
||||
return "packets"
|
||||
case "octets":
|
||||
return "bytes"
|
||||
case "mtu":
|
||||
return "octets"
|
||||
case "speed":
|
||||
return "bits"
|
||||
}
|
||||
return v
|
||||
}
|
||||
return "events"
|
||||
}
|
||||
switch suffix := metric[idx:]; suffix {
|
||||
|
|
Loading…
Add table
Reference in a new issue