#!/bin/bash
UP=$(echo 'showServers()' | dnsdist -c | grep State -A 20 | awk '{print $4'} | grep up | wc -l)
DOWN=$(echo 'showServers()' | dnsdist -c | grep State -A 20 | awk '{print $4'} | grep down | wc -l)
if [[ "$UP" -lt 4 || "$DOWN" -gt 3 ]]; then
echo "dnsdist_pools - CRIT - Servers Up: $UP Servers Down: $DOWN"
exit 2
else
echo "dnsdist_pools - OK - Servers Up: $UP Servers Down: $DOWN"
exit 0
fi