Skip to content

Instantly share code, notes, and snippets.

@debedb
Last active April 5, 2024 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save debedb/4fc48fa65b85952b4eb6dd7ea1f598c2 to your computer and use it in GitHub Desktop.
Save debedb/4fc48fa65b85952b4eb6dd7ea1f598c2 to your computer and use it in GitHub Desktop.
cloudwatch-agent-sucks
#!/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