监视适用于Windows的AWS CloudWatch实例中的内存使用情况 [英] Monitoring memory usage in AWS CloudWatch for Windows instance

查看:139
本文介绍了监视适用于Windows的AWS CloudWatch实例中的内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,CloudWatch不监视内存使用情况.所以我尝试使用

By default, memory usage isn’t monitored by CloudWatch. So I tried to add it to my Windows instance in AWS using these instructions.

这就是我所做的:

  1. 我创建了一个名为custom-metrics-user的用户.然后,我存储了访问权限和密钥.

  1. I created a user named custom-metrics-user. Then I stored the access and secret key.

我创建了一个内联策略并将其附加到用户.看起来像这样:

I created and attached an Inline Policy to the user. it looks like this:

{ 
  "Version": "2012-10-17", 
  "Statement": [ 
    { 
      "Effect": "Allow", 
      "Action": ["cloudwatch:PutMetricData", "cloudwatch:GetMetricStatistics", "cloudwatch:ListMetrics", "ec2:DescribeTags"], 
      "Resource": "*" 
    } 
  ] 
}

我启动了Windows实例[2012 R2 Base AMI].通过RDP访问实例后,我发现AWS.EC2.Windows.CloudWatch.json文件已经存在.

I launched a Windows Instance [2012 R2 Base AMI]. After accessing the instance through RDP, I found that the AWS.EC2.Windows.CloudWatch.json file is already present.

我相应地更改了.json文件.更改后,它看起来像这样:

I changed that .json file accordingly. After changing it, it looks like this:

{
    "EngineConfiguration": {
        "PollInterval": "00:00:15",
        "Components": [
            {
                "Id": "ApplicationEventLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogName": "Application",
                    "Levels": "1"
                }
            },
            {
                "Id": "SystemEventLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogName": "System",
                    "Levels": "7"
                }
            },
            {
                "Id": "SecurityEventLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                "LogName": "Security",
                "Levels": "7"
                }
            },
            {
                "Id": "ETW",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogName": "Microsoft-Windows-WinINet/Analytic",
                    "Levels": "7"
                }
            },
            {
                "Id": "IISLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.IisLog.IisLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogDirectoryPath": "C:\\inetpub\\logs\\LogFiles\\W3SVC1"
                }
            },
            {
                "Id": "CustomLogs",
                "FullName": "AWS.EC2.Windows.CloudWatch.CustomLog.CustomLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogDirectoryPath": "C:\\CustomLogs\\",
                    "TimestampFormat": "MM/dd/yyyy HH:mm:ss",
                    "Encoding": "UTF-8",
                    "Filter": "",
                    "CultureName": "en-US",
                    "TimeZoneKind": "Local"
                }
            },
            {
                "Id": "PerformanceCounter",
                "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": "CloudWatchLogs",
                "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "AccessKey": "",
                    "SecretKey": "",
                    "Region": "us-east-1",
                    "LogGroup": "Default-Log-Group",
                    "LogStream": "{instance_id}"
                }
            },
            {
                "Id": "CloudWatch",
                "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": 
                {
                    "AccessKey": "AKIAIK2U6EU675354BQ",
                    "SecretKey": "nPyk9ntdwW0y5oaw8353fsdfTi0e5/imx5Q09vz",
                    "Region": "us-east-1",
                    "NameSpace": "System/Windows"
                }
            }
        ],
        "Flows": {
            "Flows": 
            [
                "PerformanceCounter,CloudWatch"
            ]
        }
    } 
}

我在EC2ConfigSettings下启用了CloudWatch Logs集成.

I enabled CloudWatch Logs integration under EC2ConfigSettings.

我重新启动了EC2Config服务.

I restarted the EC2Config Service.

我没有任何错误,但是内存"指标未在Cloud Watch控制台中显示.该博客说,要等待10到15分钟才能显示该指标,但是距离我已经花了一个小时了.怎么了?

I got no errors but the Memory metric isn't being shown in the Cloud Watch console. The blog says to wait for 10-15 minutes for the metric to appear, but it has already been an hour since I have done it. What’s going wrong?

推荐答案

我正在运行Windows 2012 Base R2服务器,并且正在运行大于4.0的EC2Config版本.如果有人遇到相同的问题,请在重新启动EC2Config服务后 重新启动Amazon SSM代理服务 .

I am running a Windows 2012 Base R2 Server and it is running EC2Config Version greater than 4.0. If anyone faces the same problem, please restart the Amazon SSM Agent Service after restarting EC2Config Service.

我在以下链接[ STEP-6 ]中阅读了它:

I read it in the following link [STEP-6] :

http://docs.aws.amazon.com/AWSEC2 /latest/WindowsGuide/send_logs_to_cwl.html

其内容如下:

如果运行的是EC2Config 4.0版或更高版本,则必须从Microsoft服务管理单元中重新启动实例上的SSM代理.

If you are running EC2Config version 4.0 or later, then you must restart the SSM Agent on the instance from the Microsoft Services snap-in.

我通过这样做解决了我的问题.

I solved my issue by doing this.

这篇关于监视适用于Windows的AWS CloudWatch实例中的内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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