1
votes

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:

  • option 1: prevent the ASG name change upon deploy
  • option 2: dynamically update the plots with the new name
  • option 3: plot the same data without using the ASG name (but alternatives I find are EC2 instance ID that changes and ImageId and InstanceType that are common to more than one EC2, so won't work either)

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:

2
Are you trying to reference Elastic Beanstalk when you use the EBS acronym, or Elastic Block Store? - Mark B
i mean Elastic Beanstalk. edited. thanks - Vetras

2 Answers

1
votes

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" } ]
]
0
votes

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)