Currently, I am having incorrect math operation from AWS Cloudwatch Ops through Grafana dashboard.

I need to get the failure rate for AWSBackupJobs.

I set:

$A → NumberOfBackupJobsFailed

$B → NumberOfBackupJobsAborted

$C → NumberOfBackupJobsCreated

So, I put ‘(($A + $B) / $C) * 100’ in the math expression column in Grafana dashboard.

However, when I tested the expression with different constant numbers, it does not give correct results.

For example, if you put ($A + 5) / $C * 100 as a math operation, the panel (failure rate for AWS BackupJobs) always gives 0.

Do you know why the ‘’(($A + $B) / $C) * 100’’ operation does not work out when dealing with CloudWatch metrics in Grafana?

I guess because your A, B, C produces timeseries and not single numbers.

I would use CloudWatch math instead of Grafana expression + long `Period`

aggregation (e.g. 365d instead of auto), so you will get single number results from A,B,C queries.