Unable to push Server Work Queue Length custom metric to Cloud Watch

100 Views Asked by At

I am unable to publish Server Work Queue Length custom metric to Cloud Watch. I was able to figure out my mistake but unable to do it as I am clueless as to what to use there.

This is the PerformanceCounter block for this metric :

{
    "Id": "PerformanceCounter",
    "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
    "Parameters": {
         "CategoryName": "Server Work Queues",
         "CounterName": "Queue Length",
         "InstanceName": "",
         "MetricName": "QueueDepth",
         "Unit": "Count",
         "DimensionName": "InstanceId",
         "DimensionValue": "{instance_id}"
    }
},

The problem with the above code is the InstanceName parameter.

According to AWS Documentation,

In the InstanceName parameter, enter valutes from the Add Counters dialog box in Performance Monitor, which can be one of the following:

  • Blank, if the selected object has no instances.

  • A single instance of the selected object.

  • _Total to use the aggregate of all instances.

Note: Do not use an asterisk (*) to indicate all instances because each performance counter component only supports one metric.

Add Counters dialog box in Performance Monitor shows the following :

enter image description here

So the Counters Section shows All instances. AWS Documentation, as bulleted above says not to use * if the counter shows All Instances, but doesnot say what to use. I have used _Total and also left it blank. Both of them did not work.

By following the same points mentioned above, I successfully monitored Memory, Logical Disk Space, Paging File etc.

For Paging File, I used _Total as the InstanceName as it is mentioned there in the Performance Counter. Below snapshot shows that.

enter image description here

For Logical Disk Free Space, I used the _Total as InstanceName as the counter in the PerformanceMonitor showed up.

enter image description here

For Memory, I left the InstanceName value as blank as the counter in the PerformanceMonitor showed nothing.

enter image description here

I have been trying this from almost three days without any success. Please suggest me what to use there.

2

There are 2 best solutions below

3
On

According to the documantation:

For each performance counter that you want to upload to CloudWatch, copy the PerformanceCounter section and change the Id parameter to make it unique (e.g., "PerformanceCounter2") and update the other parameters as necessary.

Assuming that you have other PerformanceCounter sections in your JSON file, you should have unique ids for each section. Everything else seems fine.

0
On

Did you try high level API call like this: https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/examples-cloudwatch-publish-custom-metrics.html

I followed this and found no issue.