Amazon CloudWatch Monitoring Scripts for Microsoft Windows
Update (January 6, 2016) – The scripts described in this blog post have been deprecated and are no longer available.
For updated information on how to perform the same tasks in a more modern fashion, please take a look at Sending Performance Counters to CloudWatch and Logs to CloudWatch Logs, Configuring a Windows Instance Using the EC2Config Service, and Monitoring Memory and Disk Statistics for Amazon EC2 Linux Instances.
A number of AWS services collect and then report various metrics to Amazon CloudWatch. The metrics are stored for two weeks and can be viewed in the AWS Management Console. They can also be used to drive alarms and notifications.
Applications can use CloudWatch’s custom metrics facility to store any desired metrics. These metrics are also stored for two weeks and can be used as described above.
Each Amazon EC2 instance reports a number of metrics to CloudWatch. These metrics are collected and reported by the hypervisor, and as such reflect only the data that the hypervisor can see — CPU load, network traffic, and so forth. In order to report on items that are measured by the guest operating system (Linux or Windows) you need to run a monitoring script on the actual system.
Today we are introducing a set of monitoring scripts for EC2 instances running any supported version of Microsoft Windows Server. The scripts are implemented in Windows PowerShell and are provided in sample form so that you can examine and customize them as needed.
- mon-put-metrics-mem.ps1 collects metrics related to system memory usage and sends them to CloudWatch.
- mon-put-metrics-disk.ps1 collects metrics related to disk usage and sends them to CloudWatch.
- mon-put-metrics-perfmon.ps1 collects metrics from PerfMon counters and sends them to CloudWatch.
- mon-get-instance-stats.ps1 queries CloudWatch and displays the most recent utilization statistics for the instance it was run on.
You will need to install and configure the AWS SDK for .NET in order to make use of the scripts.
PS – We also have similar monitoring scripts for Linux.