Created
November 23, 2012 12:15
-
-
Save corvax19/4135359 to your computer and use it in GitHub Desktop.
Simple DNS resolve monitor with email notification #singleliner
This file contains 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
ping -q -i1 -c3 target 2>&1|awk '/unknown host/{system("mailx -s \""$4" DNS resolution failed on `uname -n` at `date`\" [email protected] >/dev/null")} /[:alpha:]/{S=S" "$0} END {print S}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Things to adjust:
target - put your hostname of interest here;
-i10 - pinging interval in seconds;
-c30 - pinging counter;
[email protected] - your email here, as Bill could be unresponsive on such notifications.
Put it on cron. With -i10 and -c30 - schedule it for each 5 minutes (5min = 300 sec = 10 * 30)