optix2000 / nsd_exporter Goto Github PK
View Code? Open in Web Editor NEWPrometheus exporter for NSD (Name Server Daemon)
License: BSD 3-Clause "New" or "Revised" License
Prometheus exporter for NSD (Name Server Daemon)
License: BSD 3-Clause "New" or "Revised" License
Better behavior would be to sleep and retry the connection instead of this:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4ee6c6]
goroutine 1 [running]:
io/ioutil.devNull.ReadFrom(0x0, 0x0, 0x0, 0x7ea2c0, 0x800b73601, 0x800c1aa38)
/usr/local/go/src/io/ioutil/ioutil.go:147 +0x66
io.copyBuffer(0x8bcaa0, 0xb86f08, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7c0a60, 0x201, 0xc0003aae40)
/usr/local/go/src/io/io.go:388 +0x303
io.Copy(0x8bcaa0, 0xb86f08, 0x0, 0x0, 0x0, 0x8bc060, 0xc00042a6e0)
/usr/local/go/src/io/io.go:364 +0x5a
github.com/optix2000/go-nsdctl.NewClient(0x84f3c5, 0x3, 0x7fffffffedc5, 0xe, 0x7fffffffed6e, 0x21, 0x7fffffffed95, 0x22, 0x7fffffffed47, 0x22, ...)
/wrkdirs/usr/ports/net-mgmt/nsd_exporter/work/src/github.com/optix2000/go-nsdctl/nsdctl.go:267 +0x58d
main.NewNSDCollector(0x84f3c5, 0x3, 0x7fffffffedc5, 0xe, 0x7fffffffed6e, 0x21, 0x7fffffffed95, 0x22, 0x7fffffffed47, 0x22, ...)
/wrkdirs/usr/ports/net-mgmt/nsd_exporter/work/src/github.com/optix2000/nsd_exporter/nsd_exporter.go:150 +0xc1
main.main()
/wrkdirs/usr/ports/net-mgmt/nsd_exporter/work/src/github.com/optix2000/nsd_exporter/nsd_exporter.go:201 +0x30f
We found the following strange behavior due to high amount of incoming /metrics queries....
``fatal error: concurrent map read and map write
goroutine 855 [running]:
runtime.throw(0x857b0c, 0x21)
/usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc0003c1c48 sp=0xc0003c1c18 pc=0x4389f2
runtime.mapaccess2_faststr(0x7e4200, 0xc00020e9f0, 0xc00024e6d8, 0xf, 0x0, 0x1)
/usr/local/go/src/runtime/map_faststr.go:116 +0x4a5 fp=0xc0003c1cb8 sp=0xc0003c1c48 pc=0x415ca5
main.(*NSDCollector).updateMetric(0xc000210110, 0xc00024e6d8, 0x11, 0xc00024e6d8, 0x11)
/drone/src/nsd_exporter.go:117 +0xdc fp=0xc0003c1de0 sp=0xc0003c1cb8 pc=0x79a61c
main.(*NSDCollector).Collect(0xc000210110, 0xc000074f00)
/drone/src/nsd_exporter.go:81 +0x61e fp=0xc0003c1f20 sp=0xc0003c1de0 pc=0x79a29e
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:443 +0x12b fp=0xc0003c1fe0 sp=0xc0003c1f20 pc=0x759c2b
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc0003c1fe8 sp=0xc0003c1fe0 pc=0x46e161
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:535 +0xe4d
goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x7f04dd6aaaf0, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:222 +0x55
internal/poll.(*pollDesc).wait(0xc00025c298, 0x72, 0x0, 0x0, 0x84c859)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Accept(0xc00025c280, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:401 +0x212
net.(*netFD).accept(0xc00025c280, 0x8c4f7df3af0f2851, 0x0, 0x0)
/usr/local/go/src/net/fd_unix.go:172 +0x45
net.(*TCPListener).accept(0xc0002ae870, 0x64804546, 0xc0003bfd20, 0x4d31c6)
/usr/local/go/src/net/tcpsock_posix.go:139 +0x32
net.(*TCPListener).Accept(0xc0002ae870, 0xc0003bfd70, 0x18, 0xc000000180, 0x71ffdb)
/usr/local/go/src/net/tcpsock.go:261 +0x65
net/http.(*Server).Serve(0xc00024c380, 0x8cae60, 0xc0002ae870, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2981 +0x285
net/http.(*Server).ListenAndServe(0xc00024c380, 0xc00024c380, 0x8)
/usr/local/go/src/net/http/server.go:2910 +0xba
net/http.ListenAndServe(...)
/usr/local/go/src/net/http/server.go:3164
main.main()
/drone/src/nsd_exporter.go:253 +0x313
goroutine 66 [select]:
github.com/prometheus/client_golang/prometheus.(*Registry).Gather(0xc0000ca500, 0x0, 0x0, 0x0, 0x0, 0x0)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:510 +0xb65
github.com/prometheus/client_golang/prometheus/promhttp.HandlerFor.func1(0x7f04dc4fdef8, 0xc0001442d0, 0xc000512500)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/http.go:126 +0x99
net/http.HandlerFunc.ServeHTTP(0xc0002a9f10, 0x7f04dc4fdef8, 0xc0001442d0, 0xc000512500)
/usr/local/go/src/net/http/server.go:2069 +0x44
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1(0x7f04dc4fdef8, 0xc0001442d0, 0xc000512500)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:40 +0xab
net/http.HandlerFunc.ServeHTTP(0xc00020ff20, 0x7f04dc4fdef8, 0xc0001442d0, 0xc000512500)
/usr/local/go/src/net/http/server.go:2069 +0x44
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1(0x8cb040, 0xc00030e1c0, 0xc000512500)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:100 +0xdf
net/http.HandlerFunc.ServeHTTP(0xc0002b8030, 0x8cb040, 0xc00030e1c0, 0xc000512500)
/usr/local/go/src/net/http/server.go:2069 +0x44
net/http.(*ServeMux).ServeHTTP(0xafa5e0, 0x8cb040, 0xc00030e1c0, 0xc000512500)
/usr/local/go/src/net/http/server.go:2448 +0x1ad
net/http.serverHandler.ServeHTTP(0xc00024c380, 0x8cb040, 0xc00030e1c0, 0xc000512500)
/usr/local/go/src/net/http/server.go:2887 +0xa3
net/http.(*conn).serve(0xc0002461e0, 0x8cbe58, 0xc00002e100)
/usr/local/go/src/net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3013 +0x39b
goroutine 775 [runnable]:
strconv.readFloat(0xc0003911ed, 0x1, 0x0, 0x0, 0x680500, 0xc000178158, 0xc00032625b)
/usr/local/go/src/strconv/atof.go:175 +0x5cb
strconv.atof64(0xc0003911ed, 0x1, 0x415b7d, 0xc00021be40, 0xc0003911e0, 0xc)
/usr/local/go/src/strconv/atof.go:620 +0x85
strconv.parseFloatPrefix(0xc0003911ed, 0x1, 0x40, 0xc0003911e0, 0xc0002aa538, 0x2, 0xc0002aa4e0)
/usr/local/go/src/strconv/atof.go:703 +0x95
strconv.ParseFloat(0xc0003911ed, 0x1, 0x40, 0xc, 0xc0002aa590, 0x1)
/usr/local/go/src/strconv/atof.go:691 +0x45
main.(*NSDCollector).Collect(0xc000210110, 0xc00020c480)
/drone/src/nsd_exporter.go:92 +0x3c8
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:443 +0x12b
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:535 +0xe4d
goroutine 795 [select]:
github.com/prometheus/client_golang/prometheus.(*Registry).Gather(0xc0000ca500, 0x0, 0x0, 0x0, 0x0, 0x0)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:510 +0xb65
github.com/prometheus/client_golang/prometheus/promhttp.HandlerFor.func1(0x7f04dc4fdef8, 0xc000642190, 0xc000512200)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/http.go:126 +0x99
net/http.HandlerFunc.ServeHTTP(0xc0002a9f10, 0x7f04dc4fdef8, 0xc000642190, 0xc000512200)
/usr/local/go/src/net/http/server.go:2069 +0x44
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1(0x7f04dc4fdef8, 0xc000642190, 0xc000512200)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:40 +0xab
net/http.HandlerFunc.ServeHTTP(0xc00020ff20, 0x7f04dc4fdef8, 0xc000642190, 0xc000512200)
/usr/local/go/src/net/http/server.go:2069 +0x44
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1(0x8cb040, 0xc000168540, 0xc000512200)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:100 +0xdf
net/http.HandlerFunc.ServeHTTP(0xc0002b8030, 0x8cb040, 0xc000168540, 0xc000512200)
/usr/local/go/src/net/http/server.go:2069 +0x44
net/http.(*ServeMux).ServeHTTP(0xafa5e0, 0x8cb040, 0xc000168540, 0xc000512200)
/usr/local/go/src/net/http/server.go:2448 +0x1ad
net/http.serverHandler.ServeHTTP(0xc00024c380, 0x8cb040, 0xc000168540, 0xc000512200)
/usr/local/go/src/net/http/server.go:2887 +0xa3
net/http.(*conn).serve(0xc000246280, 0x8cbe58, 0xc0004a81c0)
/usr/local/go/src/net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3013 +0x39b
goroutine 821 [IO wait]:
internal/poll.runtime_pollWait(0x7f04dd6aa3b0, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:222 +0x55
internal/poll.(*pollDesc).wait(0xc0000fe618, 0x72, 0x0, 0x1, 0xffffffffffffffff)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0000fe600, 0xc00028a461, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:166 +0x1d5
net.(*netFD).Read(0xc0000fe600, 0xc00028a461, 0x1, 0x1, 0xc0000be180, 0x0, 0x0)
/usr/local/go/src/net/fd_posix.go:55 +0x4f
net.(*conn).Read(0xc00061a258, 0xc00028a461, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:183 +0x91
net/http.(*connReader).backgroundRead(0xc00028a450)
/usr/local/go/src/net/http/server.go:692 +0x58
created by net/http.(*connReader).startBackgroundRead
/usr/local/go/src/net/http/server.go:688 +0xd5
goroutine 823 [semacquire]:
sync.runtime_Semacquire(0xc0003901e8)
/usr/local/go/src/runtime/sema.go:56 +0x45
sync.(*WaitGroup).Wait(0xc0003901e0)
/usr/local/go/src/sync/waitgroup.go:130 +0x65
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func2(0xc0003901e0, 0xc00020c480, 0xc00020c4e0)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:460 +0x2b
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:459 +0x60d
goroutine 801 [semacquire]:
sync.runtime_Semacquire(0xc0000ba048)
/usr/local/go/src/runtime/sema.go:56 +0x45
sync.(*WaitGroup).Wait(0xc0000ba040)
/usr/local/go/src/sync/waitgroup.go:130 +0x65
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func2(0xc0000ba040, 0xc000074f00, 0xc000075080)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:460 +0x2b
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:459 +0x60d
goroutine 799 [IO wait]:
internal/poll.runtime_pollWait(0x7f04dd6aaa08, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:222 +0x55
internal/poll.(*pollDesc).wait(0xc000186198, 0x72, 0x0, 0x1, 0xffffffffffffffff)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc000186180, 0xc00014b1e1, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:166 +0x1d5
net.(*netFD).Read(0xc000186180, 0xc00014b1e1, 0x1, 0x1, 0xc0002e0730, 0x466aa0, 0xc00023cd80)
/usr/local/go/src/net/fd_posix.go:55 +0x4f
net.(*conn).Read(0xc0000bc2c8, 0xc00014b1e1, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:183 +0x91
net/http.(*connReader).backgroundRead(0xc00014b1d0)
/usr/local/go/src/net/http/server.go:692 +0x58
created by net/http.(*connReader).startBackgroundRead
/usr/local/go/src/net/http/server.go:688 +0xd5``
Seeing this after building on Alpine 3.12 with Go 1.13 from aports;
# ./nsd_exporter -config-file /usr/local/etc/nsd/nsd.conf
2020/07/14 15:30:30 open /usr/local/etc/nsd/nsd: no such file or directory
# ./nsd_exporter -key /usr/local/etc/nsd/nsd_control.key -cert /usr/local/etc/nsd/nsd_control.pem -ca /usr/local/etc/nsd/nsd_server.pem
2020/07/14 15:28:33 -cert, -key, and -ca must all be defined.
golang/go#1435 is finally fixed so we can drop privileges.
Hello!
Trying to run nsd_exporter getting the following error message:
# ./nsd_exporter
2020/06/10 12:20:16 dial tcp: lookup tcp/⋸: Servname not supported for ai_socktype
what does this error message means?
I enabled %s.stats in my nsd configuration to get metrics per zone, but one of my zones contains a - which is a forbidden character in prometheus. Is there a way to configure nsd_exporter to parse these "forbidden" characters, and the issue is solved by renaming metrics in prometheus scrape configs.
thanks for the answer in advance
cli error message:
panic: descriptor Desc{fqName: "nsd_xn--d1alf_stats_num_udp", help: "number of queries on xn--d1alf over UDP ip4.", constLabels: {}, variableLabels: []} is invalid: "nsd_xn--d1alf_stats_num_udp" is not a valid metric name
goroutine 1 [running]:
github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0xc000088550, 0xc0001ddc10, 0x1, 0x1)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:400 +0xb7
github.com/prometheus/client_golang/prometheus.MustRegister(...)
/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:177
main.main()
/drone/src/nsd_exporter.go:250 +0x226
Hello, could you please help to understand what does it mean and how can i fix it?
There are a lot of errors in a log file and nsd_exporter returns http/500.
http.log
nsd-control-stats.txt
Mar 13 00:24:26 nl nsd_exporter[29420]: 2024/03/13 00:24:26 New metric gadskypapa.com.num.queries found. Refreshing.
Mar 13 00:24:26 nl nsd_exporter[29420]: 2024/03/13 00:24:26 Metric %!(EXTRA string=gadskypapa.com.num.queries, string= not found in config.)
Mar 13 00:24:26 nl nsd_exporter[29420]: 2024/03/13 00:24:26 Metric gadskypapa.com.num.queriesnot configured. Skipping
...
/usr/local/bin/nsd_exporter -cert /usr/local/etc/nsd/nsd_control.pem -ca /usr/local/etc/nsd/nsd_server.pem -key /usr/local/etc/nsd/nsd_control.key -nsd-address 127.0.0.1:8952 -listen-address 127.0.0.1:9132
NSD version 4.8.0
Written by NLnet Labs.
Configure line: --localstatedir=/var --with-configdir=/usr/local/etc/nsd --with-libevent=/usr/local --with-pidfile=/var/run/nsd/nsd.pid --with-ssl=/usr --with-user=nsd
--enable-bind8-stats --disable-checking --disable-dnstap --enable-ipv6 --enable-largefile --enable-minimal-responses --disable-mmap --enable-nsec3 --disable-packed --
enable-radix-tree --enable-ratelimit --enable-zone-stats --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/share/info/ --build=amd64-portbld-freebsd14.0
Event loop: libevent 2.1.12-stable (uses kqueue)
Linked with OpenSSL 3.0.12 24 Oct 2023
Copyright (C) 2001-2020 NLnet Labs. This is free software.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
Will need a change in optix2000/go-nsdctl
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.