Skip to content

Commit

Permalink
fix: prefer max/min for alarms (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 authored Jan 24, 2024
1 parent a33c6a0 commit 6474866
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
13 changes: 13 additions & 0 deletions terraform/monitoring/panels/rds/cpu.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local targets = grafana.targets;
notifications = vars.notifications,
refid = 'CPU',
limit = 70,
reducer = grafana.alertCondition.reducers.Max,
)
)

Expand All @@ -35,4 +36,16 @@ local targets = grafana.targets;
statistic = 'Average',
refId = 'CPU_Avg'
))

.addTarget(targets.cloudwatch(
datasource = ds.cloudwatch,
namespace = 'AWS/RDS',
metricName = 'CPUUtilization',
dimensions = {
DBClusterIdentifier: vars.rds_cluster_id,
},
matchExact = true,
statistic = 'Maximum',
refId = 'CPU_Max'
))
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ local targets = grafana.targets;
DBClusterIdentifier: vars.rds_cluster_id,
},
matchExact = true,
statistic = 'Average',
statistic = 'Maximum',
))
}
16 changes: 14 additions & 2 deletions terraform/monitoring/panels/rds/freeable_memory.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ local targets = grafana.targets;
evaluatorParams = [ 30 ],
evaluatorType = 'lt',
operatorType = 'or',
queryRefId = 'Mem_Avg',
queryRefId = 'Mem_Min',
queryTimeStart = '5m',
queryTimeEnd = 'now',
reducerType = grafana.alert_reducers.Avg
reducerType = grafana.alert_reducers.Min
),
],
))
Expand All @@ -44,4 +44,16 @@ local targets = grafana.targets;
statistic = 'Average',
refId = 'Mem_Avg',
))

.addTarget(targets.cloudwatch(
datasource = ds.cloudwatch,
namespace = 'AWS/RDS',
metricName = 'FreeableMemory',
dimensions = {
DBClusterIdentifier: vars.rds_cluster_id,
},
matchExact = true,
statistic = 'Minimum',
refId = 'Mem_Min',
))
}
11 changes: 11 additions & 0 deletions terraform/monitoring/panels/rds/volume_bytes_used.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,15 @@ local targets = grafana.targets;
matchExact = true,
statistic = 'Average',
))

.addTarget(targets.cloudwatch(
datasource = ds.cloudwatch,
namespace = 'AWS/RDS',
metricName = 'VolumeBytesUsed',
dimensions = {
DBClusterIdentifier: vars.rds_cluster_id,
},
matchExact = true,
statistic = 'Maximum',
))
}

0 comments on commit 6474866

Please sign in to comment.