Last active
April 5, 2024 23:52
-
-
Save debedb/4fc48fa65b85952b4eb6dd7ea1f598c2 to your computer and use it in GitHub Desktop.
cloudwatch-agent-sucks
This file contains hidden or 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 | |
# set -x | |
inst_id=$(ec2metadata --instance-id) | |
while : | |
do | |
used_megs=$(free --mega | awk 'NR!=1 {print $3}' | head -1) | |
aws cloudwatch put-metric-data \ | |
--region us-west-2 \ | |
--namespace gg \ | |
--metric-name mem5 \ | |
--dimensions InstanceId=${inst_id},Bar=mem5 \ | |
--unit "Megabytes" \ | |
--value $used_megs | |
# echo Free $free_megs M | |
sleep 60 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment