prometheus-community / bind_exporter

Prometheus exporter for BIND

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error parsing XML from BIND 9.16.11

0gcr opened this issue · comments

commented

$ uname -mrs
FreeBSD 12.1-RELEASE-p13 amd64

$ pkg info --comment go git bind
go-1.15.7,1 Go programming language
git-2.30.0 Distributed source code management tool
bind916-9.16.11 BIND DNS suite with updated DNSSEC and DNS64

$ named -v
BIND 9.16.11 (Stable Release) id:9ff601b

$ go get github.com/prometheus-community/bind_exporter && ~/go/bin/bind_exporter --bind.stats-url=http://localhost:8053
level=info ts=2021-01-31T07:06:44.622Z caller=bind_exporter.go:529 msg="Starting bind_exporter" version="(version=, branch=, revision=)"
level=info ts=2021-01-31T07:06:44.622Z caller=bind_exporter.go:530 msg="Build context" build_context="(go=go1.15.7, user=, date=)"
level=info ts=2021-01-31T07:06:44.622Z caller=bind_exporter.go:531 msg="Collectors enabled" collectors=server,view,tasks
level=info ts=2021-01-31T07:06:44.623Z caller=bind_exporter.go:555 msg="Listening on" address=:9119
level=info ts=2021-01-31T07:06:44.623Z caller=tls_config.go:191 msg="TLS is disabled." http2=false
level=error ts=2021-01-31T07:06:48.806Z caller=bind_exporter.go:427 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing "-": invalid syntax"
level=error ts=2021-01-31T07:07:03.869Z caller=bind_exporter.go:427 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing "-": invalid syntax"
level=error ts=2021-01-31T07:07:18.895Z caller=bind_exporter.go:427 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing "-": invalid syntax"
^C

See sample XML output.

same problem for me with
BIND 9.11.4-P2-RedHat-9.11.4-26.P2.el7 (Extended Support Version) <id:7107deb>

Thanks for the report. Any interest in working on a patch?

Hi! is there an update?

commented

Thanks for the report. Any interest in working on a patch?

As much as I'd like to be able to do that, I'm afraid this is beyond my current skill set.

We have the same problem. Is there any update on this?

Hey I've taken a look at this, and it seems that the Bind Server returns a non integer Value for the XML as seen in the sample XML Output mentioned above:

serial-non-integervalue

I think this then gets deserialized or unmarshaled onto a ZoneCounter Struct, which expects this value to be a uint64

type ZoneCounter struct {
	Name       string `xml:"name,attr"`
	Rdataclass string `xml:"rdataclass,attr"`
	Serial     uint64 `xml:"serial"`
}

I am taking a closer look now, but i can't promise a patch right now.

@SuperQ would it be okay to implement a custom unmarshal function for the Zonestruct? I think bind really does not fullfill its specification here. With the custom unmarshaling function, we can just differentiate anything that is not an int for the serial xml field.

I guess we need to change the Serial to a string, and then add some strconv.ParseUint() handling around it.

This is fixed.