如何在Windows中使用Cloud Watch监视AWS EC2上的可用磁盘空间 [英] How to monitor free disk space at AWS EC2 with Cloud Watch in windows
问题描述
如果磁盘空间剩余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
在此处将示例AWS.EC2.Windows.CloudWatch.json文件复制到Windows Server 2016 EC2实例上
C:\Program Files\Amazon\SSM\Plugins\awsCloudWatch\
Copy the sample AWS.EC2.Windows.CloudWatch.json file on your Windows Server 2016 EC2 Instance here
C:\Program Files\Amazon\SSM\Plugins\awsCloudWatch\
编辑AWS.EC2.Windows.CloudWatch.json并将IsEnabled设置为true
Edit AWS.EC2.Windows.CloudWatch.json and set IsEnabled true
根据需要添加其他指标.配置中有一个样本用于内存使用.复制/粘贴此代码,并更改Metric名称,如下所示:
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
Run Powershell as administrator and run
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上的可用磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!