存档说明:本文记录了 2019 年使用的旧版 CloudWatch 监控脚本。
在 AWS 责任共担模式下,客户机操作系统内部的情况需要由用户自行监控。因此,内存和磁盘使用率等指标,需要在操作系统内配置采集。
我当时找到的最好的参考资料在这里: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html
下面是在 Amazon Linux AMI 上的简要操作步骤:
sudo yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
unzip CloudWatchMonitoringScripts-1.2.2.zip
crontab -e
将以下条目添加到 crontab 中:
*/5 * * * * /root/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=/ --from-cron


云 / 系统