Amazon CloudWatch監視Windows Server2008的磁碟空間使用率配置

來源:互聯網
上載者:User

 

在AWS啟動Windows Server2008之後,預設以安裝了EC2ConfigService。

在這裡介紹一下,使用EC2ConfigService服務建立CloudWatch自訂監視磁碟使用率。

EC2ConfigServiceSettings

修改EC2ConfigServiceSettings配置

修改JSON檔案

重啟EC2ConfigService

1. 修改EC2ConfigServiceSettings配置

啟動C:\Program Files\Amazon\Ec2ConfigService\Ec2ConfigServiceSettings.exe之後,勾選「Enable CloudWatch Logs integratin.」。

 

2. 修改JSON檔案

接著修改C:\Program Files\Amazon\Ec2ConfigService\Settings檔案夾下面的AWS.EC2.Windows.CloudWatch.json檔案。

在這裡僅監視Windows Server的磁碟使用率。

{
    "EngineConfiguration": {
        "PollInterval": "00:05:00",
        "Components": [
            {
                "Id": "PerformanceCounter",
                "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "CategoryName": "LogicalDisk",
                    "CounterName": "% Free Space",
                    "InstanceName": "C:",
                    "MetricName": "DiskFree",
                    "Unit": "Percent",
                    "DimensionName": "InstanceId",
                    "DimensionValue": "{instance_id}"
                }
            },
            {
                "Id": "CloudWatch",
                "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters":
                {
                    "AccessKey": "[填寫AccessKey]",
                    "SecretKey": "[填寫SecretKey]",
                    "Region": "[填寫Region]",
                    "NameSpace": "Windows/Default"
                }
            }
        ],
        "Flows": {
            "Flows":
            [
                "PerformanceCounter,CloudWatch"
            ]
        }
    }
}
3. 重啟EC2ConfigService

>net stop ec2config
The Ec2Config service is stopping..
The Ec2Config service was stopped successfully.

>net start ec2config
The Ec2Config service is starting.
The Ec2Config service was started successfully.
在CloudWatch,確認是否擷取到監控值

點擊「Metrics」下面的「Windows/Default」。

 

確認DiskFree的值。

 

結語

在這裡沒有提IAM使用者及角色(至少給使用者附加CloudWatchFullAccess策略),給EC2賦予許可權的方法一般有2種。

啟動EC2之前建立角色,並在啟動EC2時把建立好的角色賦予到EC2
建立擁有指定策略的使用者,並使用該使用者的AccessKey和SecretKey訪問AWS的各種資源。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.