Created
January 16, 2017 15:36
-
-
Save mflopez79/6ebde2344d8b4c1d2607d98bfbf84433 to your computer and use it in GitHub Desktop.
Check rabbitMQ node status and put status to Cloudwatch
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
#!/bin/bash | |
if [ "$#" -ne 2 ]; then | |
echo "Illegal number of parameters" | |
echo "Usage: $0 <metric-name> <server_name>" | |
exit 100 | |
fi | |
date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
status_code=$(curl -o /dev/null -s -w "%{http_code}" -u <RABBITMQ_ADMIN_USER>:<RABBITMQ_ADMIN_PWD> "http://localhost:15672/api/healthchecks/node") | |
if [ $status_code -ne 200 ] | |
then | |
val=0 | |
else | |
val=1 | |
fi | |
/usr/local/bin/aws cloudwatch put-metric-data --metric-name $1 --namespace $2 --value $val --timestamp $date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment