Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporter dies with panic: label value [...] is not valid UTF-8 when having interface comments with Umlauts #142

Open
mattiwei opened this issue Jun 2, 2022 · 0 comments

Comments

@mattiwei
Copy link

mattiwei commented Jun 2, 2022

When scraping a Mikrotik v7.2.3, the exporter dies when an Interface comment contains an Umlaut (German ü) with the following error message:

panic: label value "078xxxxxxx 50GB/Month 12.50Fr. , Monat beginnt jeweils am 9. Abo bis 16.08.2023, 60 Tage im Voraus k\xfcnden." is not valid UTF-8

goroutine 35 [running]:
github.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)
/root/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/value.go:105
mikrotik-exporter/collector.(*interfaceCollector).collectMetricForProperty(0x7fae8e5d3008?, {0x889f93, 0xa}, 0xc0000daf80, 0xc00000e270)
/var/lib/prometheus/mikrotik-exporter/mikrotik-exporter/collector/interface_collector.go:104 +0x71d
mikrotik-exporter/collector.(*interfaceCollector).collectForStat(...)
/var/lib/prometheus/mikrotik-exporter/mikrotik-exporter/collector/interface_collector.go:66
mikrotik-exporter/collector.(*interfaceCollector).collect(0xc0000ca500, 0xc000198180?)
/var/lib/prometheus/mikrotik-exporter/mikrotik-exporter/collector/interface_collector.go:45 +0xfa
mikrotik-exporter/collector.(*collector).connectAndCollect(0xc0000da9c0, 0xc000198180, 0xc000070240)
/var/lib/prometheus/mikrotik-exporter/mikrotik-exporter/collector/collector.go:355 +0x36d
mikrotik-exporter/collector.(*collector).collectForDevice(0xc000222768?, {{0x7fffb6995840, 0x9}, {0x7fffb6995819, 0xc}, {{0x0, 0x0}, {{0x0, 0x0}, 0x0}}, ...}, ...)
/var/lib/prometheus/mikrotik-exporter/mikrotik-exporter/collector/collector.go:326 +0xe5
mikrotik-exporter/collector.(*collector).Collect.func1({{0x7fffb6995840, 0x9}, {0x7fffb6995819, 0xc}, {{0x0, 0x0}, {{0x0, 0x0}, 0x0}}, {0x7fffb6995850, ...}, ...})
/var/lib/prometheus/mikrotik-exporter/mikrotik-exporter/collector/collector.go:291 +0x78
created by mikrotik-exporter/collector.(*collector).Collect
/var/lib/prometheus/mikrotik-exporter/mikrotik-exporter/collector/collector.go:290 +0x285

Unfortunately, my golang skills are very limited, I would have tried to fix it myself if I could..

Here's what I was able to figure out so far:

  • The prometheus [email protected] accepts UTF-8 only in prometheus/value.go
  • Therefore, mikrotik-exporter ( interface_collector.go ) should convert the string in label "comment" to UTF-8 first (and maybe additionally emit a warning that the string was modified)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant