Skip to content

Commit 8588952

Browse files
authored
Merge pull request nshttpd#135 from vojta001/trunk
Quote DHCP hostname
2 parents dc93f93 + 5534653 commit 8588952

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

collector/dhcp_lease_collector.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ func (c *dhcpLeaseCollector) collectMetric(ctx *collectorContext, re *proto.Sent
7676
server := re.Map["server"]
7777
status := re.Map["status"]
7878
activeaddress := re.Map["active-address"]
79-
hostname := re.Map["host-name"]
79+
// QuoteToASCII because of broken DHCP clients
80+
hostname := strconv.QuoteToASCII(re.Map["host-name"])
8081

8182
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)
8283
if err != nil {

0 commit comments

Comments
 (0)