Code Monkey home page Code Monkey logo

bind_exporter's Introduction

Bind Exporter

GoDoc Build Status Go Report Card

Export BIND (named/dns) v9+ service metrics to Prometheus.

Getting started

Build and run from source

go get github.com/prometheus-community/bind_exporter
cd $GOPATH/src/github.com/prometheus-community/bind_exporter
make
./bind_exporter [flags]

Run in Docker container

  1. Pull Docker container using a specific version:
docker pull prometheuscommunity/bind-exporter:v0.3.0
  1. Run in a Docker container (as daemon), use --network host when communicating with named via localhost:
docker run -d --network host prometheuscommunity/bind-exporter:v0.3.0

Examples

Run bind_exporter in a Docker container and communicate with named on non-default statistics URL:

docker run -d prometheuscommunity/bind-exporter:v0.3.0 --bind.stats-url http://<IP/hostname>:8053

TLS and basic authentication

The Bind Exporter supports TLS and basic authentication.

To use TLS and/or basic authentication, you need to pass a configuration file using the --web.config.file parameter. The format of the file is described in the exporter-toolkit repository.

Other resources

Grafana Dashboard #12309

Troubleshooting

Make sure BIND was built with libxml2 support. You can check with the following command: named -V | grep libxml2.

Configure BIND to open a statistics channel. It's recommended to run the bind_exporter next to BIND, so it's only necessary to open a port locally.

statistics-channels {
  inet 127.0.0.1 port 8053 allow { 127.0.0.1; };
};

Copyright @ 2016 DigitalOcean™ Inc.

bind_exporter's People

Contributors

aauroy avatar anarcat avatar andrewsomething avatar bdronneau avatar bschoenbach avatar cagedmantis avatar christian-simmen avatar csawyeryumaed avatar dependabot[bot] avatar dswarbrick avatar elnappo avatar evesy avatar grobie avatar jedops avatar jlherren avatar lleifermann avatar mattkanwisher avatar michaelxniu avatar mikejoh avatar pecastro avatar prombot avatar richih avatar roidelapluie avatar seitanas avatar superq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bind_exporter's Issues

Support traffic metrics

There are some interesting metrics on the traffic statistics endpoint. They appear to be sparse histogram buckets. It will take some digging, but we might be able to translate these into Prometheus buckets.

<?xml version="1.0" encoding="UTF-8"?>
<statistics version="3.8">
  <server>
    <boot-time>2020-01-12T16:30:26.247Z</boot-time>
    <config-time>2020-01-12T16:30:26.371Z</config-time>
    <current-time>2020-01-12T16:42:45.433Z</current-time>
    <version>9.11.5-P4-5~bpo9+1-Debian</version>
  </server>
  <traffic>
    <ipv4>
      <udp>
        <counters type="request-size">
          <counter name="16-31">3718</counter>
          <counter name="32-47">10699</counter>
          <counter name="48-63">12175</counter>
          <counter name="64-79">834</counter>
        </counters>
        <counters type="response-size">
          <counter name="64-79">100</counter>
          <counter name="80-95">1382</counter>
          <counter name="96-111">12759</counter>
          <counter name="112-127">3157</counter>
          <counter name="128-143">847</counter>
          <counter name="144-159">1</counter>
          <counter name="176-191">50</counter>
          <counter name="192-207">8971</counter>
          <counter name="208-223">105</counter>
          <counter name="224-239">52</counter>
          <counter name="480-495">1</counter>
          <counter name="496-511">1</counter>
        </counters>
      </udp>
      <tcp>
        <counters type="request-size"/>
        <counters type="response-size"/>
      </tcp>
    </ipv4>
    <ipv6>
      <udp>
        <counters type="request-size">
          <counter name="32-47">2</counter>
          <counter name="48-63">35</counter>
        </counters>
        <counters type="response-size">
          <counter name="64-79">2</counter>
          <counter name="96-111">9</counter>
          <counter name="112-127">4</counter>
          <counter name="128-143">21</counter>
          <counter name="144-159">1</counter>
        </counters>
      </udp>
      <tcp>
        <counters type="request-size"/>
        <counters type="response-size"/>
      </tcp>
    </ipv6>
  </traffic>
  <views/>
</statistics>

how to configure in docker-compose

bind_exporter:
image: "prometheuscommunity/bind-exporter:v0.4.0"
container_name: "bind_exporter"
restart: "unless-stopped"
command: "-bind.stats-url http://fqdn-example:8053"

the container restart always. if change to "--bind.stats-url" the bind_up 0

can anybody help me?

Update metric mappings

Going over the XML, we've found a couple of issues.

Server Stats:
QryDuplicate is listed as an "error", it's actually a separate statistic for incoming query duplicates. It should be something like bind_queries_duplicated_total

QryRecursion seems to be missing from the stats. How about bind_query_recursions_total.

bind_boot_time_seconds appears to be shifting strangely

image

The issue appears to be the use of max(node_time_seconds{instance=~"$node:.*"}) which appears to not work in Prometheus 2.19, and a possible change in how Bind 9.16 reports uptime. The result is that changing the queries to time() - max(bind_boot_time_seconds{instance=~"$node:.*"}) produces sensible seeming results, but these are actually still off by an order of magnitude.

i.e. a Bind 9.16 reported boot time of 2020-07-14T21:10:48.999Z, with a current time of 2020-07-14T22:11:56.299Z will report incorrectly with the above, claiming 5.8 hours. I thought I had found the order of magnitude error, but then I noticed that something is still wrong because it wasn't updating correctly. That's when I noticed that bind_boot_time_seconds was moving. It went from 1594766106 to 1594740334, which is definitely not correct.

The actual Bind statistics do not reflect a change in the corresponding XML or JSON.

containerized HOWTO?

We run named in a container. I'd like to run bind_exporter in a container, too. However it looks like bind_exporter wants to run inside the same container as named? Is this correct? Is this required? Is there a HOWTO for configuring bind_exporter to run in a container beside the bind container?

Make fails on Centos7

Tried setting up bind_exporter on Centos7 with Go version 1.83. Make fails with below error

bind_exporter-master]# make all

formatting code

runtime

../runtime/signal_unix.go:27: _SIG_DFL redeclared in this block
previous declaration at ../runtime/signal1_unix.go:15
../runtime/signal_unix.go:28: _SIG_IGN redeclared in this block
previous declaration at ../runtime/signal1_unix.go:16
../runtime/signal_unix.go:37: fwdSig redeclared in this block
previous declaration at ../runtime/signal1_unix.go:25
../runtime/signal_unix.go:42: disableSigChan redeclared in this block
previous declaration at ../runtime/signal1_unix.go:35
../runtime/signal_unix.go:43: enableSigChan redeclared in this block
previous declaration at ../runtime/signal1_unix.go:36
../runtime/signal_unix.go:44: maskUpdatedChan redeclared in this block
previous declaration at ../runtime/signal1_unix.go:37
../runtime/signal_unix.go:56: signalsOK redeclared in this block
previous declaration at ../runtime/signal1_unix.go:49
../runtime/signal_unix.go:62: initsig redeclared in this block
previous declaration at ../runtime/signal1_unix.go:55
../runtime/signal_unix.go:97: sigInstallGoHandler redeclared in this block
previous declaration at ../runtime/signal1_unix.go:90
../runtime/signal_unix.go:122: sigenable redeclared in this block
previous declaration at ../runtime/signal1_unix.go:115
../runtime/signal_unix.go:122: too many errors
make: *** [promu] Error 2

Make failing on Raspbian 10 (buster) ARMv7 rev 3 (v7l) Pi4B

I'm running into an issue during the command Make. Please see last line for error that I'm getting. I've also attached two colored screenshots showing command Make in run. Any suggestions how do I go about fixing? Thank you guys.

:~/go/src # cd $GOPATH/src/github.com/prometheus-community/bind_exporter
:~/go/src/github.com/prometheus-community/bind_exporter # make

checking code style
checking license header
running check for unused/missing packages in go.mod
GO111MODULE=on go mod tidy
running check for unused packages in vendor/
GO111MODULE=on go mod vendor
diff --git a/go.mod b/go.mod
index 05907bf..91d8497 100644
--- a/go.mod
+++ b/go.mod
@@ -5,6 +5,8 @@ go 1.13
require (
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/prometheus/client_golang v1.6.0
github.com/prometheus/common v0.10.0
github.com/sirupsen/logrus v1.6.0 // indirect
diff --git a/vendor/modules.txt b/vendor/modules.txt
index f60df2f..f060de9 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
..............
..............
..............
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/alecthomas/kingpin.v2
make: *** [Makefile.common:216: common-unused] Error 1

image
image

Metric with list of views only

Hello,

It would be nice to have a metric with only the views available on the Bind server. That can allow a less tricky variable settings. Maybe something like:

bind_view_up{view="_bind"} 1
bind_view_up{view="_default"} 1

Thanks,

Zero values for some metrics

The server has been monitored for a week but according to some charts unchanged...
I attach screenshots.
How can I check that metrics work?

bind_exporter, version 0.3.0 (branch: HEAD, revision: c34ff3d)
build user: root@48c85d39c9a6
build date: 20200109-18:54:09
go version: go1.12.14

bind9 server version 9.11.5

prometheus server version 0.16.2

Grafana v6.4.3
dashboard https://grafana.com/grafana/dashboards/1666

Выделение_013
Выделение_012
Выделение_011

Does not work on 32bit arches

Hi,

Today I fixed an issue with the Debian package for bind_exporter (tests were not being run), and noticed all 32bit arches failing immediately. Turns out it is using uint for parsing statistics, which is not big enough in these architectures. The following patch fix the issue:

--- a/bind/bind.go
+++ b/bind/bind.go
@@ -109,28 +109,28 @@
 // Counter represents a single counter value.
 type Counter struct {
 	Name    string `xml:"name,attr"`
-	Counter uint   `xml:",chardata"`
+	Counter uint64 `xml:",chardata"`
 }
 
 // Gauge represents a single gauge value.
 type Gauge struct {
 	Name  string `xml:"name"`
-	Gauge int    `xml:"counter"`
+	Gauge int64  `xml:"counter"`
 }
 
 // Task represents a single running task.
 type Task struct {
 	ID         string `xml:"id"`
 	Name       string `xml:"name"`
-	Quantum    uint   `xml:"quantum"`
-	References uint   `xml:"references"`
+	Quantum    uint64 `xml:"quantum"`
+	References uint64 `xml:"references"`
 	State      string `xml:"state"`
 }
 
 // ThreadModel contains task and worker information.
 type ThreadModel struct {
 	Type           string `xml:"type"`
-	WorkerThreads  uint   `xml:"worker-threads"`
-	DefaultQuantum uint   `xml:"default-quantum"`
-	TasksRunning   uint   `xml:"tasks-running"`
+	WorkerThreads  uint64 `xml:"worker-threads"`
+	DefaultQuantum uint64 `xml:"default-quantum"`
+	TasksRunning   uint64 `xml:"tasks-running"`
 }
--- a/bind/v2/v2.go
+++ b/bind/v2/v2.go
@@ -51,7 +51,7 @@
 
 type Counter struct {
 	Name    string `xml:"name"`
-	Counter uint   `xml:"counter"`
+	Counter uint64 `xml:"counter"`
 }
 
 // Client implements bind.Client and can be used to query a BIND v2 API.

make compiling error in bind exporter

I have a issue while configuring bind exporter in centos.
Please give the solution

make

formatting code
can't load package: package /prometheus/source/bind_exporter-master: cannot find package "/prometheus/source/bind_exporter-master" in any of:
/usr/local/go/src//prometheus/source/bind_exporter-master (from $GOROOT)
/prometheus/go/src/
/prometheus/source/bind_exporter-master (from $GOPATH)
can't load package: package /prometheus/source/bind_exporter-master/bind: cannot find package "/prometheus/source/bind_exporter-master/bind" in any of:
/usr/local/go/src//prometheus/source/bind_exporter-master/bind (from $GOROOT)
/prometheus/go/src/
/prometheus/source/bind_exporter-master/bind (from $GOPATH)
can't load package: package /prometheus/source/bind_exporter-master/bind/auto: cannot find package "/prometheus/source/bind_exporter-master/bind/auto" in any of:
/usr/local/go/src//prometheus/source/bind_exporter-master/bind/auto (from $GOROOT)
/prometheus/go/src/
/prometheus/source/bind_exporter-master/bind/auto (from $GOPATH)
can't load package: package /prometheus/source/bind_exporter-master/bind/v2: cannot find package "/prometheus/source/bind_exporter-master/bind/v2" in any of:
/usr/local/go/src//prometheus/source/bind_exporter-master/bind/v2 (from $GOROOT)
/prometheus/go/src/
/prometheus/source/bind_exporter-master/bind/v2 (from $GOPATH)
can't load package: package /prometheus/source/bind_exporter-master/bind/v3: cannot find package "/prometheus/source/bind_exporter-master/bind/v3" in any of:
/usr/local/go/src//prometheus/source/bind_exporter-master/bind/v3 (from $GOROOT)
/prometheus/go/src/
/prometheus/source/bind_exporter-master/bind/v3 (from $GOPATH)
make: *** [format] Error 1

How to get metrics from docker

My docker-compose.yml. I've got error in prom read: connection reset by peer.
bind: image: prometheuscommunity/bind-exporter:v0.3.0 container_name: bind_exporter ports: - 8053:8053 networks: vpcbr: ipv4_address: 172.20.0.14

prometheuscommunity/bind-exporter:v0.3.0 "/bin/bind_exporter …" 15 minutes ago Up 15 minutes 9100/tcp
docker logs
time="2021-04-14T13:22:39Z" level=info msg="Starting bind_exporter (version=0.3.0, branch=HEAD, revision=c34ff3d6b4817f42e74b2b05b3797cf99683b4a9)" source="bind_exporter.go:491" time="2021-04-14T13:22:39Z" level=info msg="Build context (go=go1.12.14, user=root@48c85d39c9a6, date=20200109-18:54:09)" source="bind_exporter.go:492" time="2021-04-14T13:22:39Z" level=info msg="Configured to collect statistics \"server,view,tasks\"" source="bind_exporter.go:493" time="2021-04-14T13:22:39Z" level=info msg="Starting Server: :9119" source="bind_exporter.go:517"

Make fails on linux/armv7l

root@daac0d6bb19f:~/go/src/bind_exporter-master# make

formatting code
cmd/go: unsupported GOOS/GOARCH pair linux/armv7l
Makefile:55: recipe for target 'promu' failed
make: *** [promu] Error 2

Can't run behind nginx proxy 502 Bad Gateway

Hello Guys,

Thank you for your BIND-DNS Exporter

I am trying to run exporter behind Nginx proxy (via SSL secure communication)

[root@ns1 ~]# curl https://ns1.domain.tld
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.16.1</center>
</body>
</html>

[root@ns1 ~]# curl localhost:9119
<html>
<head><title>Bind Exporter</title></head>
<body>
<h1>Bind Exporter</h1>
<p><a href='/metrics'>Metrics</a></p>
</body>
 </html>

cmdline: /usr/bin/bind_exporter -bind.pid-file /var/run/named/named.pid -bind.stats-groups server,view,tasks

Please find my config file below, How can I fix this,

server {
    listen 80;
    server_name ns1.domain.tld localhost;
    return 301 https://ns1.domain.tld$request_uri;
}    

server {
    listen 443 ssl;
    server_name ns1.domain.tld loclahost;
    
    client_max_body_size 40M;
    charset utf-8;

    location / {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
    	proxy_pass  http://127.0.0.1:9119;
    }
}


    ## Nginx Includes
    # SSL Params
    ssl_stapling on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 5m;

    ssl_prefer_server_ciphers on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK';

    ssl_certificate /etc/ssl/dns/fullchain.pem;
    ssl_certificate_key /etc/ssl/dns/privkey.pem;
    #ssl_dhparam /etc/ssl/dtcm-ssl/dhparam.pem;


}

Detail command flags or missing metrics?

Hi,

I'm trying to use this grafana dashboard with bind_exporter:
https://grafana.com/dashboards/1666

bind_exporter started with below flags:
/usr/local/bin/bind_exporter -bind.pid-file /var/run/named/named.pid -bind.stats-groups "server,view,tasks"

But why I only can see below a few metrics items?
bind

From the dashboard, seems there should be some other metrics we can use e.g. "bind_incoming_queries_total", "bind_incoming_requests_total", "bind_responses_total" ..etc..

exporter Couldn't retrieve BIND stats: failed to unmarshal XML response

my environment:
BIND 9.12.1-P2 id:14b0e01
running on Linux x86_64 3.10.0-693.11.1.el7.x86_64 #1 SMP Mon Dec 4 23:52:40 UTC 2017
built by make with '--prefix=/data/apps/bind' '--with-dlz-mysql=/usr/' '--enable-threads=yes' '--enable-largefile' '--disable-ipv6' '--with-libxml2'
compiled by GCC 4.8.5 20150623 (Red Hat 4.8.5-16)
compiled with OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
linked to OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017
compiled with libxml2 version: 2.9.1
linked to libxml2 version: 20901
compiled with zlib version: 1.2.7
linked to zlib version: 1.2.7
threads support is enabled

centos(7.4.1708) rpms:
libxml2-devel-2.9.1-6.el7_2.3.x86_64
libxml2-2.9.1-6.el7_2.3.x86_64

exporter logs error:
bind_exporter[24794]: time="2020-02-27T17:14:13+08:00" level=error msg="Couldn't retrieve BIND stats: failed to unmarshal XML response: strconv.ParseInt: parsing "18446744073709551609": value out of range" source="bind_exporter.go:405"

bind exporter is running, but not get bind records metric 。
help fix it.

Release v0.2.0

We've been the current master in production for a while and it's pretty stable. Can we get a proper release including tarballs for each arch/os? I'm happy to take this over if you need help if you add me as collaborator to this repository.

Export build_info

Hi,
it would be nice to export the build_info like other exporters does.

# HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which node_exporter was built.
# TYPE node_exporter_build_info gauge
node_exporter_build_info{branch="release",goversion="go1.8.3",revision="d7d629e9a1400482f2801207ba4e4f2f6ee80b33",version="0.14.0"} 1

Megacheck and go1.8.x

Hi,
I wanted to report that some vendors are actually outdated and megacheck report some possible errors.
Are you thinking about doing a new release? TravisCI should use go1.8.x instead of 1.7.

See,

bind/v2/v2.go:108:9: should use type conversion instead of struct literal (S1016)
bind_exporter.go:476:28: prometheus.Handler is deprecated: Please note the issues described in the doc comment of InstrumentHandler. You might want to consider using promhttp.Handler instead (which is not instrumented).  (SA1019)

Proposal: remove vendor directory

In line with node_exporter recently removing the vendor directory, it would simplify packaging if bind_exporter merely used go.mod and modern dependency management.

It looks like a few other things could do with a bit of modernizing too (like the removal of GO111MODULE=on)

What do you think, @SuperQ ?

improve documentation: what are the units in?

The graphs in grafana https://grafana.com/grafana/dashboards/1666 are cool, but there is absolutely no mention anywhere in documentation or graphs themselves, what are the units?

I can see for example incoming queries - what are they:

  • Queries since launch?
  • Queries per second?
  • Queries per minute?
  • Queries since last fetch?

It would be really useful to know this, seeing just numbers with no context is misleading and useless

Having some issues running the bind exporter

Running bind_exporter throws the following error and the service dies when trying to get out to the URL

(root@test:~)# ./bind_exporter
{"level":"info","msg":"Starting Server: :9109","time":"2015-10-01T10:33:23-04:00"}

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x55336d]

goroutine 24 [running]:
github.com/prometheus/client_golang/prometheus.(_CounterVec).WithLabelValues(0x0, 0xc8202d9c08, 0x1, 0x1, 0x0, 0x0)
/root/go/src/github.com/prometheus/client_golang/prometheus/counter.go:141 +0xbd
main.(_Exporter).Collect(0xc820018840, 0xc82017a120)
/root/go/src/github.com/digitalocean/bind_exporter/bind_exporter.go:211 +0xb46
github.com/prometheus/client_golang/prometheus.(_registry).writePB.func2(0xc82016a1c0, 0xc82017a120, 0x2b88bba77df8, 0xc820018840)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:413 +0x58
created by github.com/prometheus/client_golang/prometheus.(_registry).writePB
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:414 +0x343

goroutine 1 [IO wait]:
net.runtime_pollWait(0x2b88bba77b48, 0x72, 0xc82000a240)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc820120d80, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc820120d80, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).accept(0xc820120d20, 0x0, 0x2b88bba78120, 0xc8201760a0)
/usr/local/go/src/net/fd_unix.go:408 +0x27c
net.(_TCPListener).AcceptTCP(0xc820028158, 0x455ec0, 0x0, 0x0)
/usr/local/go/src/net/tcpsock_posix.go:254 +0x4d
net/http.tcpKeepAliveListener.Accept(0xc820028158, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2135 +0x41
net/http.(_Server).Serve(0xc820018c00, 0x2b88bba780e8, 0xc820028158, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1887 +0xb3
net/http.(_Server).ListenAndServe(0xc820018c00, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1877 +0x136
net/http.ListenAndServe(0x8d03a8, 0x5, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1967 +0x8f
main.main()
/root/go/src/github.com/digitalocean/bind_exporter/bind_exporter.go:285 +0x3d6

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 18 [IO wait]:
net.runtime_pollWait(0x2b88bba77a88, 0x72, 0xc82000a240)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc82016e060, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc82016e060, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).Read(0xc82016e000, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x2b88bba72050, 0xc82000a240)
/usr/local/go/src/net/fd_unix.go:232 +0x23a
net.(_conn).Read(0xc820172000, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:172 +0xe4
net/http.(_liveSwitchReader).Read(0xc820174048, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:219 +0xa4
io.(_LimitedReader).Read(0xc820176020, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:427 +0xbd
bufio.(_Reader).fill(0xc82017a000)
/usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(_Reader).ReadSlice(0xc82017a000, 0xc81fff3d0a, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:328 +0x21a
bufio.(_Reader).ReadLine(0xc82017a000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:357 +0x53
net/textproto.(_Reader).readLineSlice(0xc820170150, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/textproto/reader.go:55 +0x81
net/textproto.(_Reader).ReadLine(0xc820170150, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/textproto/reader.go:36 +0x40
net/http.ReadRequest(0xc82017a000, 0xc8201840e0, 0x0, 0x0)
/usr/local/go/src/net/http/request.go:653 +0xb6
net/http.(_conn).readRequest(0xc820174000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:633 +0x32f
net/http.(_conn).serve(0xc820174000)
/usr/local/go/src/net/http/server.go:1319 +0x727
created by net/http.(_Server).Serve
/usr/local/go/src/net/http/server.go:1910 +0x3f6

goroutine 19 [chan receive]:
github.com/prometheus/client_golang/prometheus.(_registry).writePB(0xc8200186c0, 0x2b88bd8b5390, 0xc820176480, 0x0, 0x0)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:425 +0x3fd
github.com/prometheus/client_golang/prometheus.(_registry).ServeHTTP(0xc8200186c0, 0x2b88bd8b5280, 0xc820172010, 0xc820184000)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:373 +0x173
net/http.(Handler).ServeHTTP-fm(0x2b88bd8b5280, 0xc820172010, 0xc820184000)
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:61 +0x50
github.com/prometheus/client_golang/prometheus.InstrumentHandlerFuncWithOpts.func1(0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:158 +0x335
net/http.HandlerFunc.ServeHTTP(0xc820079180, 0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/usr/local/go/src/net/http/server.go:1422 +0x3a
net/http.(_ServeMux).ServeHTTP(0xc820010a50, 0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/usr/local/go/src/net/http/server.go:1699 +0x17d
net/http.serverHandler.ServeHTTP(0xc820018c00, 0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/usr/local/go/src/net/http/server.go:1862 +0x19e
net/http.(_conn).serve(0xc8201740b0)
/usr/local/go/src/net/http/server.go:1361 +0xbee
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:1910 +0x3f6

goroutine 20 [chan send]:
github.com/prometheus/client_golang/prometheus.computeApproximateRequestSize(0xc820184000, 0xc82017a0c0, 0x144f)
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:187 +0x1b6
created by github.com/prometheus/client_golang/prometheus.InstrumentHandlerFuncWithOpts.func1
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:146 +0x18c

goroutine 21 [runnable]:
sync.runtime_Semacquire(0xc82016a1cc)
/usr/local/go/src/runtime/sema.go:43 +0x26
sync.(_WaitGroup).Wait(0xc82016a1c0)
/usr/local/go/src/sync/waitgroup.go:126 +0xb4
github.com/prometheus/client_golang/prometheus.(_registry).writePB.func1(0xc82016a1c0, 0xc82017a120)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:407 +0x21
created by github.com/prometheus/client_golang/prometheus.(*registry).writePB
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:409 +0x26c

goroutine 32 [IO wait]:
net.runtime_pollWait(0x2b88bba77908, 0x72, 0xc82000a240)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc82016e370, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc82016e370, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).Read(0xc82016e310, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x2b88bba72050, 0xc82000a240)
/usr/local/go/src/net/fd_unix.go:232 +0x23a
net.(_conn).Read(0xc8201720a8, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x2b88bd8b5088, 0xc8201720a8, 0xc820174318, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/transport.go:1370 +0x67
net/http.(_noteEOFReader).Read(0xc820176820, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
:126 +0xd0
bufio.(_Reader).fill(0xc82017a960)
/usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(_Reader).Peek(0xc82017a960, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(_persistConn).readLoop(0xc8201742c0)
/usr/local/go/src/net/http/transport.go:876 +0xf7
created by net/http.(*Transport).dialConn
/usr/local/go/src/net/http/transport.go:685 +0xc78

goroutine 33 [select]:
net/http.(_persistConn).writeLoop(0xc8201742c0)
/usr/local/go/src/net/http/transport.go:1009 +0x40c
created by net/http.(_Transport).dialConn
/usr/local/go/src/net/http/transport.go:686 +0xc9d
(root@test:~)#

Bind process information missing on FreeBSD 11.1

I have set the bind.pid-file to the right location but the exporter doesn't show any process metrics. The resolver and response metrics show up fine. I am mostly interested in the file descriptor info.

Switch logging to promlog

Similar to the other official Prometheus projects, we have been switching logging from github.com/prometheus/common/log to github.com/prometheus/common/promlog. This uses go-kit for logging.

what is the important index?

i konw this bind_exporter has many index of bind , but i dont konw the important index, so what is the important index ,which we should pay attention to sth ?
Waiting for your reply!

SELinux enablement doc update

When using a custom port for the statistics channel on an SELinux enabled host, the port needs to be tagged with SELinux policy.

https://bugzilla.redhat.com/show_bug.cgi?id=1778349

add custom port to dns_port_t type, which would allow bind to listen on that port.

$ (sudo) semanage port -a -t dns_port_t -p tcp 8053

All current port assigned to a type could be obtained by command

$ semanage port -l | grep dns_port_t

Cant make on Debian Squeeze

dennis@Mango:~/.go/src/github.com/digitalocean/bind_exporter$ make

formatting code
building binaries
bind_exporter

github.com/digitalocean/bind_exporter/bind/v2

bind/v2/v2.go:81: cannot convert t (type Counter) to type bind.Counter
bind/v2/v2.go:84: cannot convert t (type Counter) to type bind.Counter
bind/v2/v2.go:87: cannot convert t (type Counter) to type bind.Counter
bind/v2/v2.go:95: cannot convert t (type Counter) to type bind.Counter
bind/v2/v2.go:98: cannot convert t (type Counter) to type bind.Counter
!! command failed: build -o /home/dennis/.go/src/github.com/digitalocean/bind_exporter/bind_exporter -ldflags -X github.com/digitalocean/bind_exporter/vendor/github.com/prometheus/common/version.Version=0.2.0-dev -X github.com/digitalocean/bind_exporter/vendor/github.com/prometheus/common/version.Revision=dae68f9a72da14e080aea554b7d4f1495904ba1a -X github.com/digitalocean/bind_exporter/vendor/github.com/prometheus/common/version.Branch=master -X github.com/digitalocean/bind_exporter/vendor/github.com/prometheus/common/version.BuildUser=dennis@Mango -X github.com/digitalocean/bind_exporter/vendor/github.com/prometheus/common/version.BuildDate=20170730-15:05:10 -extldflags '-static' github.com/digitalocean/bind_exporter: exit status 2
Makefile:43: recipe for target 'build' failed
make: *** [build] Error 1

Bind Exporter fails when zone cannot be loaded

I've added master example.com zone to Bind configuration, but didn't create master DNS zone on server, reloaded Bind and got following Bind errors:

May  7 11:43:14 hostname named[8104]: zone example.com/IN: loading from master file /master/example.com.zone failed: file not found
May  7 11:43:14 hostname named[8104]: zone example.com/IN: not loaded due to errors.

Bind itself handles this gracefully and continues serving existing zones. Bind exporter, however, started failing immediately with following errors:

May  7 12:07:07 hostname bind_exporter: level=error ts=2021-05-07T12:07:07.045Z caller=bind_exporter.go:427 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing \\"-\\": invalid syntax"
$ curl -s localhost:9119/metrics | grep bind_up
# HELP bind_up Was the Bind instance query successful?
# TYPE bind_up gauge
bind_up 0
$ pkg_info | grep bind_exporter
bind_exporter-0.4.0 Prometheus BIND exporter

Relevant XML code:

<zone name="example.com" rdataclass="IN"><type>master</type><serial>-</serial><loaded>1970-01-01T00:00:00Z</loaded><counters type="rcode"
><counter name="Requestv4">0</counter><counter name="Requestv6">0</counter><counter name="ReqEdns0">0</counter><counter name="ReqBadEDNSVer">0</cou
nter><counter name="ReqTSIG">0</counter><counter name="ReqSIG0">0</counter><counter name="ReqBadSIG">0</counter><counter name="ReqTCP">0</counter><
counter name="TCPConnHighWater">0</counter><counter name="AuthQryRej">0</counter><counter name="RecQryRej">0</counter><counter name="XfrRej">0</cou
nter><counter name="UpdateRej">0</counter><counter name="Response">0</counter><counter name="TruncatedResp">0</counter><counter name="RespEDNS0">0<
/counter><counter name="RespTSIG">0</counter><counter name="RespSIG0">0</counter><counter name="QrySuccess">0</counter><counter name="QryAuthAns">0
</counter><counter name="QryNoauthAns">0</counter><counter name="QryReferral">0</counter><counter name="QryNxrrset">0</counter><counter name="QrySE
RVFAIL">0</counter><counter name="QryFORMERR">0</counter><counter name="QryNXDOMAIN">0</counter><counter name="QryRecursion">0</counter><counter na
me="QryDuplicate">0</counter><counter name="QryDropped">0</counter><counter name="QryFailure">0</counter><counter name="XfrReqDone">0</counter><cou
nter name="UpdateReqFwd">0</counter><counter name="UpdateRespFwd">0</counter><counter name="UpdateFwdFail">0</counter><counter name="UpdateDone">0<
/counter><counter name="UpdateFail">0</counter><counter name="UpdateBadPrereq">0</counter><counter name="RecursClients">0</counter><counter name="D
NS64">0</counter><counter name="RateDropped">0</counter><counter name="RateSlipped">0</counter><counter name="RPZRewrites">0</counter><counter name
="QryUDP">0</counter><counter name="QryTCP">0</counter><counter name="NSIDOpt">0</counter><counter name="ExpireOpt">0</counter><counter name="KeepA
liveOpt">0</counter><counter name="PadOpt">0</counter><counter name="OtherOpt">0</counter><counter name="CookieIn">0</counter><counter name="Cookie
New">0</counter><counter name="CookieBadSize">0</counter><counter name="CookieBadTime">0</counter><counter name="CookieNoMatch">0</counter><counter
 name="CookieMatch">0</counter><counter name="ECSOpt">0</counter><counter name="QryNXRedir">0</counter><counter name="QryNXRedirRLookup">0</counter
><counter name="QryBADCOOKIE">0</counter><counter name="SynthNXDOMAIN">0</counter><counter name="SynthNODATA">0</counter><counter name="SynthWILDCA
RD">0</counter><counter name="QryTryStale">0</counter><counter name="QryUsedStale">0</counter><counter name="Prefetch">0</counter><counter name="Ke
yTagOpt">0</counter><counter name="RecLimitDropped">0</counter></counters><counters type="gluecache"><counter name="GLUECACHEhitspresent">0</counte
r><counter name="GLUECACHEhitsabsent">0</counter><counter name="GLUECACHEinsertspresent">0</counter><counter name="GLUECACHEinsertsabsent">0</count
er></counters><counters type="qtype"/><counters type="dnssec-sign"/><counters type="dnssec-refresh"/></zone>

Looks like it fails because serial value is reported as -.

bind 9.10 exports differently?

Hi, I'm running this with bind 9.10: 1:9.10.3.dfsg.P2-4 under ubuntu, and there is barfs with:

ERRO[0028] Failed to unmarshal XML response: expected element type <isc> but have <statistics>  source=bind_exporter.go:219

Probems configuring stats groups

When starting up the server with -bind.stats-groups=system,view,tasks the exporter tries to export duplicate metrics, which causes errors. Appears to be because the -bind.stats-groups switch only appends to the existing default rather than overwriting it.

Sep 26 08:49:34 dns01.dmacc.net bind_exporter[2982]: {"level":"info","msg":"Configured to collect statistics \"server,view,server,view,tasks\"","source":"bind_exporter.go:449","time":"2016-09-26T08:48:41-05:00"}
[root@dns01 ~]# curl http://10.16.0.152:9119/metrics
An error has occurred during metrics collection:

74 error(s) occurred:
* collected metric bind_boot_time_seconds gauge:<value:1.474896667e+09 >  was collected before with the same name and label values
* collected metric bind_config_time_seconds gauge:<value:1.474897059e+09 >  was collected before with the same name and label values
* collected metric bind_incoming_queries_total label:<name:"type" value:"A" > counter:<value:3 >  was collected before with the same name and label values
* collected metric bind_incoming_queries_total label:<name:"type" value:"SOA" > counter:<value:52 >  was collected before with the same name and label values
* collected metric bind_incoming_requests_total label:<name:"opcode" value:"QUERY" > counter:<value:55 >  was collected before with the same name and label values
* collected metric bind_incoming_requests_total label:<name:"opcode" value:"IQUERY" > counter:<value:0 >  was collected before with the same name and label values
* collected metric bind_incoming_requests_total label:<name:"opcode" value:"STATUS" > counter:<value:0 >  was collected before with the same name and label values

Error parsing XML from BIND 9.16.11

$ 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.

exporter impact on my dns bind performance

this is my environment:
bind version: 9.10.7
bind_exporter: version 0.2.0-dev (branch: master, revision: fdbe49f)
go version: go1.9.4
pull_interval: 1m

test via go program :
startDomain := time.Now()
_, err := net.LookupHost("test.com")
elapsed := time.Since(startDomain)

in every same interval time ,i find client query is very slow than other time ,query time about is 100ms , and this time is monitor pull data;

image

Release v0.2.0 Doesn't Execute on Ubuntu 16.04

Hi, really having a tough time with golang and I can't get make to work at all (as noted in similar issue threads) so instead of compiling I was hoping to just use the pre-compiled binary for v0.2.0

Release downloaded from:
https://github.com/digitalocean/bind_exporter/releases/download/v0.2.0-dev/bind_exporter

Works perfectly fine on my Mac:

Macbook$ ./bind_exporter
INFO[0000] Starting bind_exporter (version=0.2.0-dev, branch=master, revision=dae68f9a72da14e080aea554b7d4f1495904ba1a)  source="bind_exporter.go:455"
INFO[0000] Build context (go=go1.8.3, user=root@a8276f7e0479, date=20

Won't run at all on Ubuntu 16:

Linux_Server$ ./bind_exporter
-bash: ./bind_exporter: cannot execute binary file: Exec format error

The compilation from source issues I'm experiencing are the same type error noted here from another user: #32

I'll continue to hack away at it but any help is very much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.