I am Setting up AWS autoscaling, and while setting scaling policy i ran into this problem.
I wanted to use memory as a parameter, so i installed CLoudwatch's script for memory monitoring from below link.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html
When i use it for simple instance it works fine. but when i do it for autosacling with below command as suggested in above doc it gives error
Command
./mon-put-instance-data.pl --mem-util --mem-used --mem-avail --auto-scaling=only
Error:
WARNING: The Auto Scaling metrics will not be reported this time.
when i check this error on internet few people said it may be error of instance-id in /var/tmp/aws-mon i checked that is not the issue.
Any help is appreciated.
Working Solution if your instance belongs to Autoscaling group.
rm -rf /var/tmp/aws-mon/
Then run,
./mon-put-instance-data.pl --mem-util --auto-scaling=only
When the monitoring script runs it caches the instance_id under /var/tmp/aws-mon
.
One of the filters it uses when getting the auto scaling group name is the instance id. The TTL on this is 6 hours, so if your AMI has this cache, the query will use the wrong instance id for up to 6 hours after the instance is created which results in it failing to retrieve the auto scaling group name.
REF: https://forums.aws.amazon.com/thread.jspa?threadID=117783
Here is link to AWS support with same question.
Here is link to source code of the Perl script. I'm not sure if it can be publicated here, so open the ZIP file go to mon-put-instance-data.pl
, and search for reported
. From that to ifs it appear that the error occurs if you did not provided verify
, nor autoscaling group name. Since first is only for testing - we have winner. Please provide autoscaling group name parameter...
Well, there are no that parameter, but if you look closer you can see that some lines before reported
from find, there is query for that. So... your instance has no access.
Googling with CloudWatchClient::get_auto_scaling_group
gives this result. From there you can read that you should grant your instance permission to publish data to CloudWatch...
If you have other questions, please - ask. I'll edit this answer, so we will have something more or less complete - not only for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With