Vetras
Vetras

Reputation: 1999

AWS cloud watch metrics with ASG name changes

On AWS cloud watch we have one dashboard per environment. Each dashboard has N plots. Some plots, use the Auto Scaling Group Name (ASG) to find the data to plot.

Example of such a plot (edit, tab source):

{
    "metrics": [
        [ "production", "mem_used_percent", "AutoScalingGroupName", "awseb-e-rv8y2igice-stack-AWSEBAutoScalingGroup-3T5YOK67T3FD" ]
    ],
    ... other params removed for brevity ...
    "title": "Used Memory (%)",
}

Every time we deploy, the ASG name changes (deploy using code-deploy with Elastic Bean Stalk (EBS) configuration files from source). I need to manually find the new name and update the N plots one by one.

The strange thing is that this happens for production and staging environments, but not for integration.

All 3 should be copies of one another, with different settings from the EBS configuration files, so I don't know what is going on.

In any case, what (I think) I need is one of:

My online-search-foo has turned out empty.


More Info:

I'm publishing these metrics with the cloud watch agent, by adjusting the conf file, as per the docs here:

Upvotes: 1

Views: 1083

Answers (2)

DharmSonariya
DharmSonariya

Reputation: 1

Simply search the desired result in the console, results that match the search appear.

To graph, all of the metrics that match your search, choose Graph search

and find the accurate search expression that you want in the Details on the Graphed metrics tab.

SEARCH('{CWAgent,AutoScalingGroupName,ImageId,InstanceId,InstanceType} mem_used_percent', 'Average', 300)

Upvotes: 0

Have a look at CloudWatch Search Expression Syntax. It allows you to use tokens for searching, e.g.:

SEARCH(' {AWS/CWAgent, AutoScalingGroupName} MetricName="mem_used_percent" rv8y2igice', 'Average', 300)

which would replace the entry for metrics like so:

"metrics": [
    [ { "expression": "SEARCH(' {AWS/CWAgent, AutoScalingGroupName} MetricName=\"mem_used_percent\" rv8y2igice', 'Average', 300)", "label": "Expression1", "id": "e1" } ]
]

Upvotes: 1

Related Questions