13

After cloning an EC2 instance using AMI (to change a hosts security group), none of the statistics reported by the Amazon-provided mon-put-instance-data.pl script are showing up in CloudWatch.

I can confirm that the script is reporting the data to CloudWatch but it's not showing up in the CloudWatch console:

# ./mon-put-instance-data.pl --aws-credential-file=/root/.aws-credentials --mem-util --disk-space-util --disk-path=/ --swap-util
Successfully reported metrics to CloudWatch. Reference Id: xxxxxxxx-xxxx-xxxx-xxxx-93f25b4efbc7
syncsynchalt
  • 481
  • 4
  • 7
  • 2
    Figured it out thanks to strace. The current instance id is cached in /var/tmp/aws-mon and that incorrect cache was preserved via the AMI process. The solution: # mv /var/tmp/aws-mon /var/tmp/aws-mon.bak – syncsynchalt Feb 02 '14 at 01:12

1 Answers1

25

Figured it out thanks to strace. The current instance id is cached in /var/tmp/aws-mon and that incorrect cache was preserved via the AMI process.

The solution:

# mv /var/tmp/aws-mon /var/tmp/aws-mon.bak
syncsynchalt
  • 481
  • 4
  • 7
  • 9
    I believe a better solution would be to remove the temporary folder when the new instance is created: "rm -rf /var/tmp/aws-mon" – barbolo Jul 08 '15 at 11:45
  • I'm see a similar thing with a Windows instance. The CloudWatch Agent seems to be using a cached instance id, every new instance writes to the same stream. Not sure what to delete from the AMI for Windows? – Philip Apr 29 '18 at 02:30