问题描述
我想在我的磁盘空间剩余 10% 时发出警报.
I want to make alarm in case that there is 10% left in my disk space.
我阅读了一些关于如何使用 Cloud Watch 监控可用磁盘空间的文章,但我认为它似乎仅适用于 linux.
I read some articles of how monitoring free disk space with Cloud Watch but I think it seems to be only for linux.
您有任何监控 Windows 可用磁盘空间的解决方案吗?
Do you have any solution for monitoring free disk space for windows?
提前致谢.
推荐答案
这是如何配置 Windows 2016 EC2 实例以报告可用磁盘空间(或服务器上的任何其他性能计数器)
This is how to configure a Windows 2016 EC2 instance to report free disk space (or any other performance counter on your server)
下载示例
AWS.EC2.Windows.CloudWatch.json
文件.这是我找到一个的地方.https://s3.amazonaws.com/ec2-downloads-windows/CloudWatchConfig/AWS.EC2.Windows.CloudWatch.json
Download a sample
AWS.EC2.Windows.CloudWatch.json
file. This is where I found one.https://s3.amazonaws.com/ec2-downloads-windows/CloudWatchConfig/AWS.EC2.Windows.CloudWatch.json
在此处复制 Windows Server 2016 EC2 实例上的示例 AWS.EC2.Windows.CloudWatch.json 文件C:Program FilesAmazonSSMPluginsawsCloudWatch
Copy the sample AWS.EC2.Windows.CloudWatch.json file on your Windows Server 2016 EC2 Instance hereC:Program FilesAmazonSSMPluginsawsCloudWatch
编辑 AWS.EC2.Windows.CloudWatch.json 并将 IsEnabled 设置为 true
Edit AWS.EC2.Windows.CloudWatch.json and set IsEnabled true
根据需要添加其他指标.配置中有一个用于内存使用的示例.复制/粘贴它并像这样更改指标名称:
Add additional metrics as required. There is a sample one in the config for memory usage. Copy/paste this and alter the Metric name like this:
{
"Id": "PerformanceCounterDisk",
"FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"CategoryName": "LogicalDisk",
"CounterName": "% Free Space",
"InstanceName": "C:",
"MetricName": "FreeDiskPercentage",
"Unit": "Percent",
"DimensionName": "InstanceId",
"DimensionValue": "{instance_id}"
}
}
以管理员身份运行Powershell并运行
Restart-Service AmazonSSMAgent
新的 CloudWatch 指标几乎立即出现在 AWS CloudWatch 中.
New CloudWatch metrics appear almost instantly in AWS CloudWatch.
根据需要配置 AWS CloudWatch 警报.
Configure AWS CloudWatch alarms as required.
此外,我制作了一个简短的视频,其中包含一些有关在 Windows Server 2016 上进行设置的提示.
Additionally, I made a short video with some tips on setting this up on Windows Server 2016.
https://www.youtube.com/watch?v=xKVrJJyG-4I
来自 AWS 的以下指南包含分步指南.http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/send_logs_to_cwl_instances.html#send_logs_cwl_configfile
The following guide from AWS contains a step by step guide.http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/send_logs_to_cwl_instances.html#send_logs_cwl_configfile
这篇关于如何使用 Windows 中的 Cloud Watch 监控 AWS EC2 的可用磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!