I want to check DNS service queries on my Nagios Monitoring system...
So that as per official tutorials i have deployed the server, clients and also configure the agent on the client machine...
by-default plugin "check_dns" is working but new plugin for BIND 9.10 "check_bind9_stats_new.sh" is given the below output...
===================================================================================================================
[root@auth plugins]# ./check_bind9_stats_new.sh -H localhost
syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5/XML/Parser.pm line 187 at /usr/bin/xml_grep line 167
syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5/XML/Parser.pm line 187 at /usr/bin/xml_grep line 167
syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5/XML/Parser.pm line 187 at /usr/bin/xml_grep line 167
syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5/XML/Parser.pm line 187 at /usr/bin/xml_grep line 167
syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5/XML/Parser.pm line 187 at /usr/bin/xml_grep line 167
syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5/XML/Parser.pm line 187 at /usr/bin/xml_grep line 167
syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5/XML/Parser.pm line 187 at /usr/bin/xml_grep line 167
OK: Bind 9 Stats Collected | total_queries=c QryRTT_10=c QryRTT_100=c QryRTT_500=c QryRTT_800=c QryRTT_1600=c QryRTT_Over1600=c
====================================================================================================================
for more information below is the scripts details of the plugin...
==================================================================================================
Code: Select all
#!/bin/bash
#set -xv
: '
Script to fetch server(xml) statistics from Bind 9.10(and above?) servers
No WARNING or CRITICAL thresholds, only for perfdata.
Requires curl and xml_grep
Also requires this config in Bind(change x.x.x.x to "Nagios" src IP:
statistics-channels {
inet * port 8080 allow { 192.168.0.5; 127.0.0.1; };
};
'
# Nagios return codes
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
TIMEOUT=20
# Plugin variable description
PROGRAMDESCRIPTION="Check Bind9 Statistics(new format)"
PROGNAME=$(basename $0)
RELEASE="Revision 0.1"
AUTHOR="bjorn@frostberg.net"
# Functions plugin usage
print_release() {
echo "$RELEASE $AUTHOR"
}
print_usage() {
echo ""
echo "$PROGNAME $RELEASE - $PROGRAMDESCRIPTION"
echo ""
echo "Usage: $PROGNAME [-H | --hostaddress ]"
echo ""
echo " -h Show this page"
echo " -H Host address"
echo ""
}
print_help() {
print_usage
echo ""
print_release $PROGNAME $RELEASE
echo ""
echo ""
exit 0
}
# Make sure the correct number of command line arguments have been supplied
if [ $# -lt 1 ]; then
print_usage
exit $STATE_UNKNOWN
fi
# Grab the command line arguments
while [ $# -gt 0 ]; do
case "$1" in
-h | --help)
print_help
exit $STATE_OK
;;
-H | --hostaddress)
shift
HOSTADDRESS=$1
;;
*) echo "Unknown argument: $1"
print_usage
exit $STATE_UNKNOWN
;;
esac
shift
done
RESULT=`curl -S http://$HOSTADDRESS:8080/xml/v3/server --max-time $TIMEOUT 2>/dev/null`
QUERIES=`echo "$RESULT" | xml_grep '*[@type="qtype"]' 2>/dev/null | grep "counter name" | sed 's/</\"/g' | sed 's/>/\"/g'`
OUT_QUERIES=`echo "$RESULT" | xml_grep '*[@type="resqtype"]' 2>/dev/null | grep "counter name" | sed 's/</\"/g' | sed 's/>/\"/g'`
QryRTT10=`echo "$RESULT" | xml_grep -t '*[@name="QryRTT10"]' | head -1`
QryRTT100=`echo "$RESULT" | xml_grep -t '*[@name="QryRTT100"]' | head -1`
QryRTT500=`echo "$RESULT" | xml_grep -t '*[@name="QryRTT500"]' | head -1`
QryRTT800=`echo "$RESULT" | xml_grep -t '*[@name="QryRTT800"]' | head -1`
QryRTT1600=`echo "$RESULT" | xml_grep -t '*[@name="QryRTT1600"]' | head -1`
QryRTTOver1600=`echo "$RESULT" | xml_grep -t '*[@name="QryRTT1600+"]' | head -1`
TOTAL_QUERIES=`echo "$RESULT" | xml_grep -t '*[@name="QUERY"]' | head -1`
if [ -z "$RESULT" ]
then
"Stats collection failed"
exit $STATE_UNKNOWN
fi
echo -n "OK: Bind 9 Stats Collected | "
echo -n "total_queries=$TOTAL_QUERIES""c "
IFS=$'\n'
for line in `echo "$QUERIES"`
do
IFS=$'\"' read ignore ingore TYPE ignore COUNTER ignore ignore ignore value <<< "$line"
echo "query_$TYPE=$COUNTER""c " | tr -d '\n'
done
for line in `echo "$OUT_QUERIES"`
do
IFS=$'\"' read ignore ingore TYPE ignore COUNTER ignore ignore ignore value <<< "$line"
echo "query-out_$TYPE=$COUNTER""c " | tr -d '\n'
done
echo -n "QryRTT_10=$QryRTT10""c QryRTT_100=$QryRTT100""c QryRTT_500=$QryRTT500""c QryRTT_800=$QryRTT800""c QryRTT_1600=$QryRTT1600""c QryRTT_Over1600=$QryRTTOver1600""c"
echo
exit $STATE_OK
Already searched Google but didnt get any solution, hints to solve the problem, out there.
It would be great to have some help....
Thanks in advance...