Current Path : /opt/zabbix_scripts/ |
|
Current File : //opt/zabbix_scripts/check_IllegalZoneFileNames.sh |
#!/bin/bash
#########################################################################
# #
# Plugin name: check_IllegalZoneFileNames.sh #
# Description: Plugin to check for zone file backups that should #
# not be present among actively used zone files. This #
# is to avoid the name servers experiencing issues #
# processing the files and ultimately logging errors or #
# in a more extreme scenario, causing the name servers #
# to crash or go into a continuous loop attempting to #
# load the zone file(s). #
# Author: William Overko #
# Version: 20191212 #
# #
#########################################################################
illegalZoneFileNames=`find /var/named/ -name "*_*" \! -name "*parse_cache" -printf "%f\n"`
illegalZoneFileNameCount=`find /var/named/ -name "*_*" \! -name "*parse_cache" -printf "%f\n" | wc -l`
if [ ${illegalZoneFileNameCount} -eq 0 ]
then
echo -e "OK. No processes found."
exit 0
elif [ ${illegalZoneFileNameCount} -gt 0 ]
then
echo -e "CRITICAL. Illegal Zone File Name(s): ${illegalZoneFileNames[@]}."
exit 2
fi
Copyright 2K16 - 2K18 Indonesian Hacker Rulez