Last active
April 20, 2024 03:01
-
-
Save audacioustux/74de715c3bc607f6e3461e0a917a1821 to your computer and use it in GitHub Desktop.
curl -sSL https://gist.github.com/audacioustux/74de715c3bc607f6e3461e0a917a1821/raw/2038fe511dc6f9a9cd346debb455fcaf2056c3fe/amazon-cloudwatch-agent.sh | bash
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 | |
cd /tmp | |
wget https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb | |
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb | |
echo '{ | |
"agent": { | |
"metrics_collection_interval": 60, | |
"run_as_user": "cwagent" | |
}, | |
"metrics": { | |
"append_dimensions": { | |
"InstanceId": "${aws:InstanceId}" | |
}, | |
"metrics_collected": { | |
"disk": { | |
"measurement": [ | |
"used_percent" | |
], | |
"metrics_collection_interval": 60, | |
"resources": [ | |
"/" | |
] | |
} | |
} | |
} | |
}' | sudo tee -a /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json | |
sudo systemctl restart amazon-cloudwatch-agent | |
sleep 5 | |
tail -f /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment