Skip to content

Instantly share code, notes, and snippets.

@Nill-R
Last active February 26, 2020 07:10
Show Gist options
  • Save Nill-R/4cc19727451116dcb60d7347914724c4 to your computer and use it in GitHub Desktop.
Save Nill-R/4cc19727451116dcb60d7347914724c4 to your computer and use it in GitHub Desktop.
Simple monitoring scripts using nagios plugin
#!/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