Amazon have extended the CloudWatch monitoring to include some Linux scripts. These scripts run in the background and can push system metrics to CloudWatch.
The following metrics can be obtained:
- Memory Utilisation – Memory allocated by applications and the operating system, exclusive of caches and buffers, in percentages.
- Memory Used – Memory allocated by applications and the operating system,in megabytes.
- Memory Available – System memory available for applications and the operating system, in megabytes.
- Disk Space Utilisation – Disk space usage as percentages.
- Disk Space Used – Disk space usage in gigabytes.
- Disk Space Available – Available disk space in gigabytes.
- Swap Space Utilisation – Swap space usage as a percentage.
- Swap Space Used – Swap space usage in megabytes.
Note: Disk space for one or more mount points or directories can be reported on.
Note: CloudWatch only stores data for 2 weeks.
The scripts will use IAM (Identity and Access Management) to submit the data to CloudWatch.
Output from the scripts can be used with AutoScaling (e.g. scale up if memory utilisation is high.)
Aggregated metrics can be obtained from multiple instances (e.g. total memory usage across all EC2 instances.)
More information here