Inhaltsverzeichnis

DNS Queries (bind)

Wenn man bind als DNS Server einsetzt, dann gibt es einen recht einfachen Weg die Statistik der Queries für Zabbix zugänglich zu machen.

Vorarbeiten am Server

bind

Dazu muss man erst die Statisik von bind zu aktivieren.

#/etc/bind/named.conf.local
statistics-channels {
 inet 127.0.0.1 port 8053 allow { 127.0.0.1; };
};

und den bind neustarten.

Notwendige Pakete installieren

Dann braucht es die beiden Pakete curl und xml2, was bei einem Debian auch schnell erledigt ist

apt-get install xml2 curl -y

Testen

Jetzt kann man mal mit folgendem Kommando testen ob man Antworten von bind bekommt

curl http://localhost:8053/ 2>/dev/null | xml2 | grep -A1 queries

Das sollte eine solche Ausgabe erzeugen

/isc/bind/statistics/server/queries-in/rdtype/name=A
/isc/bind/statistics/server/queries-in/rdtype/counter=1098
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=NS
/isc/bind/statistics/server/queries-in/rdtype/counter=34
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=PTR
/isc/bind/statistics/server/queries-in/rdtype/counter=264
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=MX
/isc/bind/statistics/server/queries-in/rdtype/counter=197
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=TXT
/isc/bind/statistics/server/queries-in/rdtype/counter=6
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=AAAA
/isc/bind/statistics/server/queries-in/rdtype/counter=156
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=DNSKEY
/isc/bind/statistics/server/queries-in/rdtype/counter=10
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=AXFR
/isc/bind/statistics/server/queries-in/rdtype/counter=136
/isc/bind/statistics/server/queries-in/rdtype
/isc/bind/statistics/server/queries-in/rdtype/name=ANY
/isc/bind/statistics/server/queries-in/rdtype/counter=7
/isc/bind/statistics/server/nsstat/name=Requestv4

zabbix-agentd.conf anpassen

Jetzt öffnet man die zabbix-agentd.conf des DNS-Server und trägt folgende Userparameter ein

UserParameter=bind.queries.in[*],curl http://localhost:8053/ 2>/dev/null | xml2 | grep -A1 "/isc/bind/statistics/server/queries-in/rdtype/name=$1$" | tail -1 | cut -d= -f2
UserParameter=bind.queries.out[*],curl http://localhost:8053/ 2>/dev/null | xml2 | grep -A1 "/isc/bind/statistics/views/view/rdtype/name=$1$" | tail -1 | cut -d= -f2

Items auf dem Zabbix Server

Damit kann man auf dem Zabbix-Server dann folgendermassen items konfigurieren, um die verschiedenen Werte abzufragen

bind.queries.in[A]
bind.queries.out[A]

Oder hier das Template für den Import herunterladen Damit sollte es einfacher gehen