Update ec2-write-memory-metrics.sh

Removing typo - had duplicate curl command.
This commit is contained in:
Colin Johnson 2013-04-03 22:52:00 +00:00
parent ad75ad4bc2
commit 9c69efc5e3

View File

@ -1,7 +1,7 @@
#!/bin/bash - #!/bin/bash -
#get instance id - used for putting metric #get instance id - used for putting metric
INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id` INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
INSTANCE_AZ=`curl -s curl http://169.254.169.254/latest/meta-data/placement/availability-zone/` INSTANCE_AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/`
INSTANCE_REGION=${INSTANCE_AZ%?} INSTANCE_REGION=${INSTANCE_AZ%?}
#could be done using "free" or "vmstat" - use of less and grep is believed to provide widest compatibility - CJ 2011-11-24 #could be done using "free" or "vmstat" - use of less and grep is believed to provide widest compatibility - CJ 2011-11-24
@ -15,4 +15,4 @@ mon-put-data --region $INSTANCE_REGION --metric-name MemoryFree --namespace EC2/
mon-put-data --region $INSTANCE_REGION --metric-name SwapUsed --namespace EC2/Memory --value $swapused --unit Kilobytes --dimensions "InstanceId=$INSTANCE_ID" mon-put-data --region $INSTANCE_REGION --metric-name SwapUsed --namespace EC2/Memory --value $swapused --unit Kilobytes --dimensions "InstanceId=$INSTANCE_ID"
#to run in cron every 5 minutes - note that you must first provide credentials for mon-put-data #to run in cron every 5 minutes - note that you must first provide credentials for mon-put-data
#echo "*/5 * * * * ec2-user /usr/local/bin/ec2-write-memory-metrics.sh" > /etc/cron.d/ec2-write-memory-metrics #echo "*/5 * * * * ec2-user /usr/local/bin/ec2-write-memory-metrics.sh" > /etc/cron.d/ec2-write-memory-metrics