Can I use Cloudwatch Metrics Insights to provide information about missing data in the included metrics?

0

I have systems that push a custom metric to CloudWatch metrics every 5 minutes. The metric values can be 1 (healthy), 0 (unhealthy), or missing (unhealthy - occurs if the system has crashed or gone off the network and can't report metrics). I'm looking to create a Metric Insights query and from there an Alarm that will alert me if any of these systems are unhealthy. I'm using this query:

SELECT MIN(Status) FROM SCHEMA("MyNamespace", MyDimension)

When I setup the Alarm, I selected "Treat Missing Data as Bad" which would work if I only had a single metric. But with multiple metrics it appears that if I have any systems healthy, the MIN(Status) will always return 1 and I do not detect that one of my systems has gone off the network.

Is there any way to use Metric Insights to return information about missing data for any of the underlying metrics in the query?

preguntada hace 8 meses266 visualizaciones
1 Respuesta
5

Hi Bruce, look at my solution it will be helpful for your query.

It sounds like you need a way to detect missing data for any of the underlying metrics in your query. But Metric Insights doesn't directly support querying for missing data across multiple metrics in the same way as treating missing data as bad for individual metrics.

However, you can still achieve this by modifying your approach slightly. Instead of using MIN(Status), you can use the IF function to check if any of the systems are unhealthy or have missing data.

Here's how you can modify your query:

SELECT IF(COUNT(Status) = COUNT(*), 1, 0) AS Overall_Status FROM SCHEMA("MyNamespace", MyDimension)

This query will return 1 if all systems are healthy (meaning the count of reported statuses is equal to the count of systems), and 0 otherwise.

Then, when setting up the alarm, you can treat missing data as bad. This will ensure that if any system has missing data, the overall status will be considered as unhealthy, triggering the alarm.

EXPERTO
respondido hace 8 meses
profile picture
EXPERTO
revisado hace 6 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas