forked from eulenfunk/check_mk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbindcheck
executable file
·20 lines (19 loc) · 1.11 KB
/
bindcheck
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
#/usr/lib/check_mk_agent/local
export LANG=de_DE.UTF-8
## DNS check
defaultif=$(/sbin/ip -f inet route | awk '/default/ { print $5 }'|head -1)
testhost=fileserver.ffnef.de
bindrunning=$(ps ax |grep named|grep bind|wc -l)
if [ "$bindrunning" == "1" ]; then
ipv4=$(ip -4 a s $defaultif|grep inet|cut -d" " -f6|cut -d"/" -f1|head -1)
ipv6=$(ip -6 a s $defaultif|grep inet|grep -v "deprecated"|cut -d" " -f6|cut -d"/" -f1|head -1)
dns4via4=$(dig @$ipv4 A $testhost +time=1|grep -v ";"|grep A|grep $testhost|head -1|wc -l)
dns6via4=$(dig @$ipv4 AAAA $testhost +time=1|grep -v ";"|grep AAAA|grep $testhost|head -1|wc -l)
dns4via6=$(dig @$ipv6 A $testhost +time=1|grep -v ";"|grep A|grep $testhost|head -1|wc -l)
dns6via6=$(dig @$ipv6 AAAA $testhost +time=1|grep -v ";"|grep AAAA|grep $testhost|head -1|wc -l)
else
dns4via4=0; dns6via4=0; dns4via6=0; dns6via6=0;
fi
dnsstatus=$bindrunning$dns4via4$dns6via6$dns4via6$dns6via4
echo "P Dns dnsstatus=$dnsstatus.0;11110:11112;11110:11112 bindrunning=$bindrunning dns4via4=$dns4via4 dns6via6=$dns6via6 dns4via6=$dns4via6 dns6via4=$dns6via4";