Cerin
Cerin

Reputation: 64689

How to setup Cloudwatch SQL monitor?

I have a view on a PostgreSQL RDS instance that lists any ongoing deadlocks. Ideally, there are no deadlocks in the database, causing the view to show nothing, but on rare occasions, there are.

How would I setup an alarm in Cloudwatch to query this view and raise an alarm if any records return?

Upvotes: 3

Views: 2944

Answers (2)

kli
kli

Reputation: 491

I found the cool script on Github specifically for this:

A Serverless MySQL RDS Data Collection script to push Custom Metrics to CloudWatch on AWS


Basically, there are 2 main possibilities to publish any custom metrics on CloudWatch:


After all, you should set up CloudWatch alarms with Metric Math and relevant thresholds.


Upvotes: 1

John Rotenstein
John Rotenstein

Reputation: 269091

It is not possible to configure Amazon CloudWatch to look inside an Amazon RDS database.

You will need some code running somewhere that regularly runs a query on the database and sends a custom metric to Amazon CloudWatch.

For example, you could trigger an AWS Lambda function, or use cron on an Amazon EC2 instance to trigger a script.

Upvotes: 0

Related Questions