#!/bin/bash
#
# Script that runs named-checkconf and parses return code
# as Icinga warning/critical
#
# File:      	check_namedconf
# Author:    	Sven Duscha ( sven dot duscha at lrz dot de )
# Date:		2017-02-14
# Last change:  2017-02-14

OK=0
WARN=1   # when would this occur here?
CRIT=2
UNKNOWN=3
# default return value is UNKNOWN
retval=$UNKNOWN

output=`named-checkconf`

if [ "$?" -eq 0 ]
then
  echo "`which named` configuration is ok."
  retval=$OK
else
  echo "`which named` broken configuration | $output"
  retval=$CRIT
fi

exit $retval
