Add owner information

This commit is contained in:
Simon Marsh 2019-05-25 23:13:56 +01:00
parent 1a6a9190f3
commit 482152b212
Signed by: burble
GPG Key ID: 7B9FE8780CFB6593

68
dns.go
View File

@ -32,36 +32,37 @@ type DNSMetrics struct {
// for specifying DNS servers
type DNSServer struct {
role string
name string
ip uint8
addr string
soa uint64
role string
owner string
name string
ip uint8
addr string
soa uint64
}
// hardcoded :( list of DNS servers to query
var dns_servers = []*DNSServer{
&DNSServer{"master", "j.master.delegation-servers.dn42", 6, "[fd42:180:3de0:10:5054:ff:fe87:ea39]:53", 0},
&DNSServer{"delegation", "b.delegation-servers.dn42", 4, "172.20.129.1:53", 0},
&DNSServer{"delegation", "b.delegation-servers.dn42", 6, "[fd42:4242:2601:ac53::1]:53", 0},
&DNSServer{"delegation", "j.delegation-servers.dn42", 4, "172.20.1.18:53", 0},
&DNSServer{"delegation", "j.delegation-servers.dn42", 6, "[fd42:5d71:219:0:1::42]:53", 0},
&DNSServer{"delegation", "y.delegation-servers.dn42", 4, "172.20.20.66:53", 0},
&DNSServer{"delegation", "y.delegation-servers.dn42", 6, "[fd42:c01d:beef::3]:53", 0},
&DNSServer{"recursive", "a.recursive-servers.dn42", 4, "172.20.0.53:53", 0},
&DNSServer{"recursive", "a.recursive-servers.dn42", 6, "[fd42:d42:d42:54::1]:53", 0},
&DNSServer{"recursive", "b.recursive-servers.dn42", 4, "172.20.129.2:53", 0},
&DNSServer{"recursive", "b.recursive-servers.dn42", 6, "[fd42:4242:2601:ac53::53]:53", 0},
&DNSServer{"recursive", "j.recursive-servers.dn42", 4, "172.20.1.19:53", 0},
&DNSServer{"recursive", "j.recursive-servers.dn42", 6, "[fd42:5d71:219:0:1::43]:53", 0},
&DNSServer{"recursive", "y.recursive-servers.dn42", 4, "172.20.20.65:53", 0},
&DNSServer{"recursive", "y.recursive-servers.dn42", 6, "[fd42:c01d:beef::2]:53", 0},
&DNSServer{"burble.dn42", "fr-rbx1", 6, "[fd42:4242:2601:36::ac:53]:53", 0},
&DNSServer{"burble.dn42", "us-dal3", 6, "[fd42:4242:2601:2a::ac:53]:53", 0},
&DNSServer{"burble.dn42", "sg-sin2", 6, "[fd42:4242:2601:37::ac:53]:53", 0},
&DNSServer{"burble.dn42", "ca-bhs2", 6, "[fd42:4242:2601:2d::ac:53]:53", 0},
&DNSServer{"burble.dn42", "lt-vil1", 6, "[fd42:4242:2601:3d::ac:53]:53", 0},
&DNSServer{"master", "jrb0001", "j.master.delegation-servers.dn42", 6, "[fd42:180:3de0:10:5054:ff:fe87:ea39]:53", 0},
&DNSServer{"delegation", "burble", "b.delegation-servers.dn42", 4, "172.20.129.1:53", 0},
&DNSServer{"delegation", "burble", "b.delegation-servers.dn42", 6, "[fd42:4242:2601:ac53::1]:53", 0},
&DNSServer{"delegation", "jrb0001", "j.delegation-servers.dn42", 4, "172.20.1.18:53", 0},
&DNSServer{"delegation", "jrb0001", "j.delegation-servers.dn42", 6, "[fd42:5d71:219:0:1::42]:53", 0},
&DNSServer{"delegation", "yamakaja", "y.delegation-servers.dn42", 4, "172.20.20.66:53", 0},
&DNSServer{"delegation", "yamakaja", "y.delegation-servers.dn42", 6, "[fd42:c01d:beef::3]:53", 0},
&DNSServer{"recursive", "yamakaja", "a.recursive-servers.dn42", 4, "172.20.0.53:53", 0},
&DNSServer{"recursive", "yamakaja", "a.recursive-servers.dn42", 6, "[fd42:d42:d42:54::1]:53", 0},
&DNSServer{"recursive", "burble", "b.recursive-servers.dn42", 4, "172.20.129.2:53", 0},
&DNSServer{"recursive", "burble", "b.recursive-servers.dn42", 6, "[fd42:4242:2601:ac53::53]:53", 0},
&DNSServer{"recursive", "jrb0001", "j.recursive-servers.dn42", 4, "172.20.1.19:53", 0},
&DNSServer{"recursive", "jrb0001", "j.recursive-servers.dn42", 6, "[fd42:5d71:219:0:1::43]:53", 0},
&DNSServer{"recursive", "yamakaja", "y.recursive-servers.dn42", 4, "172.20.20.65:53", 0},
&DNSServer{"recursive", "yamakaja", "y.recursive-servers.dn42", 6, "[fd42:c01d:beef::2]:53", 0},
&DNSServer{"burble.dn42", "burble", "fr-rbx1", 6, "[fd42:4242:2601:36::ac:53]:53", 0},
&DNSServer{"burble.dn42", "burble", "us-dal3", 6, "[fd42:4242:2601:2a::ac:53]:53", 0},
&DNSServer{"burble.dn42", "burble", "sg-sin2", 6, "[fd42:4242:2601:37::ac:53]:53", 0},
&DNSServer{"burble.dn42", "burble", "ca-bhs2", 6, "[fd42:4242:2601:2d::ac:53]:53", 0},
&DNSServer{"burble.dn42", "burble", "lt-vil1", 6, "[fd42:4242:2601:3d::ac:53]:53", 0},
}
//////////////////////////////////////////////////////////////////////////
@ -72,25 +73,25 @@ func (m *DNSMetrics) Register() {
m.soa = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "dn42_dns_soa",
Help: "SOA for .dn42 domain",
}, []string{"role", "name", "ip", "addr"})
}, []string{"role", "owner", "name", "ip", "addr"})
prometheus.MustRegister(m.soa)
m.rtt = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "dn42_dns_rtt",
Help: "RTT when collecting SOA for .dn42 domain",
}, []string{"role", "name", "ip", "addr"})
}, []string{"role", "owner", "name", "ip", "addr"})
prometheus.MustRegister(m.rtt)
m.valid = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "dn42_dns_valid",
Help: "0 = response and correct serial, 1 = response but incorrect serial, 2 = no response",
}, []string{"role", "name", "ip", "addr"})
}, []string{"role", "owner", "name", "ip", "addr"})
prometheus.MustRegister(m.valid)
m.stime = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "dn42_dns_stime",
Help: "Returns the time between now and the SOA serial number",
}, []string{"role", "name", "ip", "addr"})
}, []string{"role", "owner", "name", "ip", "addr"})
prometheus.MustRegister(m.stime)
// pre-populate the labels
@ -98,10 +99,11 @@ func (m *DNSMetrics) Register() {
for ix, server := range dns_servers {
m.label_map[ix] = prometheus.Labels{
"role": server.role,
"name": server.name,
"ip": strconv.Itoa(int(server.ip)),
"addr": server.addr,
"role": server.role,
"owner": server.owner,
"name": server.name,
"ip": strconv.Itoa(int(server.ip)),
"addr": server.addr,
}
}