Last active
February 26, 2020 07:10
-
-
Save Nill-R/4cc19727451116dcb60d7347914724c4 to your computer and use it in GitHub Desktop.
Simple monitoring scripts using nagios plugin
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
#!/usr/bin/env bash | |
if [ -z "$1" ]; then | |
echo "No domain for check" | |
exit 1 | |
fi | |
/usr/lib/nagios/plugins/check_http -j HEAD --ssl -H $1 > /tmp/$1.check 2>&1 | |
if [ $? -eq 0 ] | |
then | |
exit 0 | |
else | |
printf "Response for $1 is\n$(cat /tmp/$1.check)\nCheck from $(hostname)\nat $(date)"|/usr/local/bin/telegram-send --stdin --disable-web-page-preview | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment