使用自定义CloudWatch指标无法监视Windows实例的可用磁盘空间 [英] Unable to monitor Free Disk Space for Windows Instances using Custom CloudWatch Metrics

查看:210
本文介绍了使用自定义CloudWatch指标无法监视Windows实例的可用磁盘空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个用户,并向他添加了以下 内联策略 。它读取以下内容:

I have created a user and added the following inline policy to him. It reads the below piece :

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowAccessToSSM",
            "Effect": "Allow",
            "Action": [
                "cloudwatch:PutMetricData",
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:DescribeLogGroups",
                "logs:DescribeLogStreams",
                "logs:PutLogEvents"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

然后,我已经成功监控了 可用内存 对.json文件进行以下更改:

Then, I have successfully monitored the Available Memory by making the following changes to the .json file :

...
{
      "Id": "PerformanceCounterMemory",
      "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
      "Parameters": {
           "CategoryName": "Memory",
           "CounterName": "Available MBytes",
           "InstanceName": "",
           "MetricName": "Memory",
           "Unit": "Megabytes",
           "DimensionName": "InstanceId",
           "DimensionValue": "{instance_id}"
       }
},

{
      "Id": "CloudWatch",
      "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch",
      "Parameters":{               
           "AccessKey": "xxxxxxxxxxxxxxxxxxx",
           "SecretKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
           "Region": "us-east-1",
           "NameSpace": "Windows/Demo"
       }
}

"Flows": {
            "Flows": 
            [
                "PerformanceCounterMemory,CloudWatch"
            ]
        }
...

以这种方式编辑文件后,我在 ec2ConfigSettings 中启用了 CloudWatch Integration 复选框>

After editing that file this way, I enabled CloudWatch Integration checkbox in ec2ConfigSettings.

接下来,我重新启动了 ec2Config Amazon SSM代理 服务。

Next, I have restarted both ec2Config and Amazon SSM Agent Services.

成功地,我可以在CloudWatch控制台中看到内存指标。

Successfully, I could see the Memory metric in my CloudWatch console.

现在,我还想监视可用的 磁盘空间

Now, I thought of monitoring the available Disk Space too.

为此,我已将此部分添加到我的.json文件中:

For that, I have added this part to my .json file :

        {
            "Id": "PerformanceCounterDisk",
            "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
            "Parameters": {
                "CategoryName": "LogicalDisk",
                "CounterName": "% Free Space",
                "InstanceName": "C:",
                "MetricName": "FreeDisk",
                "Unit": "Percent",
                "DimensionName": "InstanceId",
                "DimensionValue": "{instance_id}"
            }
        },

    "Flows": {
        "Flows": 
        [
            "(PerformanceCounterMemory,PerformanceCounterDisk),CloudWatch"
        ]
    }

这样做之后,我重新启动了两个 ec2Config Amazon SSM代理 服务,但是在我的命名空间下看不到该指标。仅显示内存,没有显示磁盘空间。

After doing this, I have restarted both the ec2Config and Amazon SSM Agent Services, but I can't see this metric under my namespace. Only memory is being shown and not disk space.

我犯了什么错误?

推荐答案

我刚刚更改了

"InstanceName": "C:",

"InstanceName": "_Total",

一段时间后,显示免费磁盘指标。

After sometime, the free disk metric showed up.

这篇关于使用自定义CloudWatch指标无法监视Windows实例的可用磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆