Use amazon-cloudwatch-agent-config-wizard to create the CloudWatch agent configuration file.
Example file:
{
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "C:\\Users\\Administrator\\Desktop\\CWMetricsLogs",
"log_group_name": "CWMetricsLogs",
"log_stream_name": "{instance_id}",
"retention_in_days": -1
}
]
},
"windows_events": {
"collect_list": [
{
"event_format": "xml",
"event_levels": [
"VERBOSE",
"INFORMATION",
"WARNING",
"ERROR",
"CRITICAL"
],
"event_name": "CloudWatchAgent",
"log_group_name": "CloudWatchAgent",
"log_stream_name": "{instance_id}",
"retention_in_days": -1
}
]
}
}
},
"metrics": {
"aggregation_dimensions": [
[
"InstanceId"
]
],
"append_dimensions": {
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
"ImageId": "${aws:ImageId}",
"InstanceId": "${aws:InstanceId}",
"InstanceType": "${aws:InstanceType}"
},
"metrics_collected": {
"LogicalDisk": {
"measurement": [
"% Free Space"
],
"metrics_collection_interval": 30,
"resources": [
"*"
]
},
"Memory": {
"measurement": [
"% Committed Bytes In Use"
],
"metrics_collection_interval": 30
},
"Paging File": {
"measurement": [
"% Usage"
],
"metrics_collection_interval": 30,
"resources": [
"*"
]
},
"PhysicalDisk": {
"measurement": [
"% Disk Time",
"Disk Write Bytes/sec",
"Disk Read Bytes/sec",
"Disk Writes/sec",
"Disk Reads/sec"
],
"metrics_collection_interval": 30,
"resources": [
"*"
]
},
"Processor": {
"measurement": [
"% User Time",
"% Idle Time",
"% Interr\upt Time"
],
"metrics_collection_interval": 30,
"resources": [
"*"
]
},
"TCPv4": {
"measurement": [
"Connections Established"
],
"metrics_collection_interval": 30
},
"TCPv6": {
"measurement": [
"Connections Established"
],
"metrics_collection_interval": 30
},
"statsd": {
"metrics_aggregation_interval": 60,
"metrics_collection_interval": 30,
"service_address": ":8125"
}
}
}
}
(Optional) to add other performance counters that are available in Performance Monitor, you run the following command:
"PerformanceCounter-Family(processor, logical disk, memory etc.)": {
"measurement": [
"Counter-name ("%Usage, "% free space" etc.)"
],
"metrics_collection_interval": 30,
"resources": [
"Counter Property ( "_total", "C:/" etc.)
]
},
Note: In the preceding command, replace the example values with your values. Also, make sure that the counters are visible in Windows Performance Monitor so that the agent can push datapoints for the counter.