14 Aug 2025 04:38 PM
Hi Community,
I want to create a Davis rule that will let me monitor the number of EC2 instances created in a specific Autoscaling group in a time window. I can get the number by counting the entity ids, but this produces a non-timesries data.
timeseries usage=avg(dt.cloud.aws.ec2.cpu.usage),by:{dt.entity.ec2_instance}, from: -24h
| fieldsAdd tags = replacePattern(tostring(entityAttr(dt.entity.ec2_instance, "tags")), """ "\\\\:" """, "_")
| parse tags, "LD:placeholder '[AWS]aws_autoscaling_groupName:' LD: asg_name '\"'" | fieldsRemove placeholder, tags
| filter asg_name == "my-monitoring"
| summarize count(), by:{asg_name}
I have been trying to use makeTimesries without success. I' getting the following all the time:
Please specify the parameter `time` explicitly, as the implicit default timestamp doesn't exist
Whe I use time: with any of the available values I get "No records"
Solved! Go to Solution.
14 Aug 2025 04:57 PM
Take a look at the solution to this post: Solved: Metric Timeseries with Array Dimension - Dynatrace Community
You have to create your own timestamps to be used in the makeTimeseries command at the end
14 Aug 2025 07:06 PM
Hi @2181 ,
A quick thought, as you need only the number of EC2 instances created in a specific Autoscaling group I believe you can also get this info directly from dt.entity ?
fetch dt.entity.ec2_instance
|fieldsAdd tags, lifetime
| expand tags
| parse tags, """LD 'groupName:' LD:asg_name"""
| filter asg_name == "eks-aws-eks-3-node-group-82c2e4f8-58e1-4942-29b4-dcd6724037ce"
| makeTimeseries count=count(default: 0), spread: timeframe(from: lifetime[start], to: coalesce(lifetime[end], now())), by:{asg_name}, interval: 1h
18 Aug 2025 10:41 AM
Thank you it worked for my case. All I had to do was twek the time window settings