AWS RDS Insights Metrics

0

Hi, I would like to query metric values for the RDS instance using the Cloudwatch Metrics Insights query language. The result should be grouped by DBInstanceIdentifier and filtered by engineName e.g. only metric values for 'mysql' instances should be returned. I've tried running queries like these:

SELECT AVG (CPUUtilization) FROM SCHEMA ("AWS/RDS", EngineName, DBInstanceIdentifier) WHERE EngineName = 'mysql' GROUP BY DBInstanceIdentifier but it doesn't return any results

and: SELECT AVG(CPUUtilization) FROM "AWS/RDS" WHERE EngineName = 'mysql' GROUP BY DBInstanceIdentifier

but I got the result like this:

"Messages": [], "MetricDataResults": [ { "Id": "m1", "Label": "Other", "StatusCode": "Complete", "Timestamps": [ some timestamps data ], "Values": [ some metric data ] } ] }

I have no idea why there is only one result with the 'Other' Label

Could I ask for help? Regards

2 Answers
0

Hello Jakub,

Ensure that you have metrics data for the last three hours before running the query, otherwise it won't bring up any results.

As for the question "Why am I unable to use the query with two dimensions?", you can query with two dimensions with a condition. But first, check your CloudWatch metrics if they have been created as the default namespaces. RDS => DBInstanceIdentifier; RDS => Databaseclass; RDS => EngineName; RDS => Across All Databases. You see, when you query AWS/RDS then you can only go to one of the next level namespaces either DBInstanceIdentifier or Databaseclass or EngineName, etc.

However (here is the condition), if you have defined your own namespaces like RDS=> DBInstanceIdentifier/EngineName, then you can run query for both.

There is as an example with API usage examples in AWS documentation (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-queryexamples.html#cloudwatch-metrics-insights-queryexamples-APIusage), it works with several namespaces, because metrics are reported under AWS/Usage => Class,Resource,Service,Type under one namespace.

Hope this helps.

AWS
answered a year ago
  • Thanks for the response, How can I define my custom namespace e.g. RDS=> DBInstanceIdentifier/EngineName? I am not able to find such an option in the AWS console.

  • My goal is to list all databases with values ​​of a given metric. They should be filtered by a given database type. The result should be the same as for this query: SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/RDS", DBInstanceIdentifier) GROUP BY DBInstanceIdentifier but additionally filtered by database type

0

Try this query without DBInstanceIdentifier in FROM SCHEMA:

SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/RDS", EngineName) WHERE EngineName = 'mysql' GROUP BY DBInstanceIdentifier

Ensure that you have data for the last three hours available in CloudWatch. It is a current CloudWatch Query limitation - https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-limits.html

As for the label "Other" - "This means that the query includes a GROUP BY clause that specifies a label key that is not used in some of the metrics that are returned by the query. In this case, a null group named Other is returned." - https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-troubleshooting.html#cloudwatch-metrics-insights-troubleshooting-other

So what happened when you ran query: SELECT AVG(CPUUtilization) FROM "AWS/RDS" WHERE EngineName = 'mysql' GROUP BY DBInstanceIdentifier

By not specifying the SCHEMA, the query was running for the metrics, which do not have any dimensions but available in the namespace "AWS/RDS" (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-querylanguage.html). That is why the query line "GROUP BY" could not find DBInstanceIdentifier and threw an error "Label": "Other".

AWS
answered a year ago
  • Thanks for the answer. Unfortunately, the proposed query returns an empty result. Only queries with one dimension return the properly grouped results e.g.:

    SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/RDS", DBInstanceIdentifier) GROUP BY DBInstanceIdentifier

    or

    SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/RDS", EngineName) GROUP BY EngineName

    Why am I unable to use the query with two dimensions?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions