diff options
-rw-r--r-- | src/go/collectors/go.d.plugin/modules/prometheus/charts.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/prometheus/charts.go b/src/go/collectors/go.d.plugin/modules/prometheus/charts.go index 61e8031d75..72d93020e2 100644 --- a/src/go/collectors/go.d.plugin/modules/prometheus/charts.go +++ b/src/go/collectors/go.d.plugin/modules/prometheus/charts.go @@ -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 { |