Created
February 22, 2022 16:58
-
-
Save deoxykev/4ced671e2d4a7cc28a427446c9ddb3ac to your computer and use it in GitHub Desktop.
DNS monitoring service as a bash one-liner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dns servers, comma separated test query send email on failure email client notification addr | |
echo -n "1.1.1.1,1.0.0.1" | xargs -d',' -I{} sh -c 'dig +timeout=5 @{} google.com | grep -q NOERROR || echo -e "To:[email protected] \nSubject:{} DNS server is unresponsive\n\nAs of $(date), {} is not responding to DNS queries for google.com." | /usr/sbin/sendmail [email protected]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment