Merge pull request #135 from vojta001/trunk

Quote DHCP hostname
This commit is contained in:
Steve Brunton 2022-06-16 21:22:49 -04:00 committed by GitHub
commit 8588952bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,7 +76,8 @@ func (c *dhcpLeaseCollector) collectMetric(ctx *collectorContext, re *proto.Sent
server := re.Map["server"] server := re.Map["server"]
status := re.Map["status"] status := re.Map["status"]
activeaddress := re.Map["active-address"] activeaddress := re.Map["active-address"]
hostname := re.Map["host-name"] // QuoteToASCII because of broken DHCP clients
hostname := strconv.QuoteToASCII(re.Map["host-name"])
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) 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 { if err != nil {