mirror of
https://github.com/nshttpd/mikrotik-exporter.git
synced 2025-04-06 18:25:44 +02:00
Merge pull request #130 from HalloweenVcK/master
Do not panic on incorrect character in dhcp lease hostname
This commit is contained in:
commit
a7a9cebbd2
@ -78,5 +78,13 @@ func (c *dhcpLeaseCollector) collectMetric(ctx *collectorContext, re *proto.Sent
|
|||||||
activeaddress := re.Map["active-address"]
|
activeaddress := re.Map["active-address"]
|
||||||
hostname := re.Map["host-name"]
|
hostname := re.Map["host-name"]
|
||||||
|
|
||||||
ctx.ch <- prometheus.MustNewConstMetric(c.descriptions, prometheus.GaugeValue, v, ctx.device.Name, ctx.device.Address, activemacaddress, server, status, strconv.FormatFloat(f, 'f', 0, 64), activeaddress, hostname)
|
metric, err := prometheus.NewConstMetric(c.descriptions, prometheus.GaugeValue, v, ctx.device.Name, ctx.device.Address, activemacaddress, server, status, strconv.FormatFloat(f, 'f', 0, 64), activeaddress, hostname)
|
||||||
|
if err != nil {
|
||||||
|
log.WithFields(log.Fields{
|
||||||
|
"device": ctx.device.Name,
|
||||||
|
"error": err,
|
||||||
|
}).Error("error parsing dhcp lease")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.ch <- metric
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user