nshttpd / mikrotik-exporter

prometheus mikrotik device(s) exporter
BSD 3-Clause "New" or "Revised" License
550 stars 153 forks source link

Crashing retrieving system health #163

Open imclint21 opened 8 months ago

imclint21 commented 8 months ago

Hi,

I got this:

{"device":"HypeRouter1","error":"strconv.ParseFloat: parsing \"n/a\": invalid syntax","level":"error","msg":"error parsing system health metric value","property":"sfp-temperature","time":"2024-01-15T08:27:04+01:00","value":"n/a"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x60 pc=0x1007f06bc]

goroutine 43 [running]:
github.com/prometheus/client_golang/prometheus.NewConstMetric(0x100999400?, 0x14000198360?, 0x14000028678?, {0x1400009a680?, 0x2?, 0x2?})
    /Users/me/go/pkg/mod/github.com/prometheus/client_golang@v1.4.1/prometheus/value.go:86 +0x1c
github.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)
    /Users/me/go/pkg/mod/github.com/prometheus/client_golang@v1.4.1/prometheus/value.go:103
mikrotik-exporter/collector.(*healthCollector).collectMetricForProperty(0x140001a40a0, {0x14000028678, 0x12}, 0x140002385c0, 0x1400000f488)
    /tmp/mikrotik-exporter/collector/health_collector.go:100 +0x378
mikrotik-exporter/collector.(*healthCollector).collect(0x140001a40a0, 0x14000130b80?)
    /tmp/mikrotik-exporter/collector/health_collector.go:46 +0xc8
mikrotik-exporter/collector.(*collector).connectAndCollect(0x1400019c340, 0x14000130b80, 0x140001c2420)
    /tmp/mikrotik-exporter/collector/collector.go:355 +0x294
mikrotik-exporter/collector.(*collector).collectForDevice(0x1400004f75c?, {{0x16f8fb74c, 0xb}, {0x16f8fb761, 0x8}, {{0x0, 0x0}, {{0x0, 0x0}, 0x0}}, ...}, ...)
    /tmp/mikrotik-exporter/collector/collector.go:326 +0xd8
mikrotik-exporter/collector.(*collector).Collect.func1({{0x16f8fb74c, 0xb}, {0x16f8fb761, 0x8}, {{0x0, 0x0}, {{0x0, 0x0}, 0x0}}, {0x16f8fb781, ...}, ...})
    /tmp/mikrotik-exporter/collector/collector.go:291 +0xb0
created by mikrotik-exporter/collector.(*collector).Collect in goroutine 42
    /tmp/mikrotik-exporter/collector/collector.go:290 +0x5f0