Skip to content

Commit

Permalink
fix: add environment to alert
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Feb 2, 2024
1 parent 1a1340d commit d9ef9e8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
5 changes: 4 additions & 1 deletion terraform/monitoring/panels/docdb/available_memory.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ local mem_alert(vars) = alert.new(
value = mem_threshold,
)

.setAlert(mem_alert(vars))
.setAlert(
vars.environment,
mem_alert(vars)
)

.addTarget(targets.cloudwatch(
refId = 'Mem_Min',
Expand Down
5 changes: 4 additions & 1 deletion terraform/monitoring/panels/docdb/cpu.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ local cpu_alert(vars) = alert.new(
datasource = ds.cloudwatch,
)
.configure(defaults.configuration.timeseries)
.setAlert(cpu_alert(vars))
.setAlert(
vars.environment,
cpu_alert(vars)
)

.addTarget(targets.cloudwatch(
refId = 'CPU_Max',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ local ops_alert(vars) = alert.new(
)
.configure(_configuration)

.setAlert(ops_alert(vars))
.setAlert(
vars.environment,
ops_alert(vars)
)

.addTarget(targets.cloudwatch(
alias = 'LowMem Num Operations Throttled (Max)',
Expand Down
15 changes: 9 additions & 6 deletions terraform/monitoring/panels/ecs/cpu.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ local overrides = defaults.overrides;
datasource = ds.cloudwatch,
)
.configure(overrides.cpu(defaults.configuration.timeseries))
.setAlert(defaults.alerts.cpu(
namespace = vars.namespace,
title = 'ECS',
env = vars.environment,
notifications = vars.notifications,
))
.setAlert(
vars.environment,
defaults.alerts.cpu(
namespace = vars.namespace,
title = 'ECS',
env = vars.environment,
notifications = vars.notifications,
)
)

.addTarget(targets.cloudwatch(
alias = 'CPU (Max)',
Expand Down
15 changes: 9 additions & 6 deletions terraform/monitoring/panels/ecs/memory.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ local targets = grafana.targets;
)
.configure(defaults.overrides.memory(defaults.configuration.timeseries))

.setAlert(defaults.alerts.memory(
namespace = vars.namespace,
title = 'ECS',
env = vars.environment,
notifications = vars.notifications,
))
.setAlert(
vars.environment,
defaults.alerts.memory(
namespace = vars.namespace,
title = 'ECS',
env = vars.environment,
notifications = vars.notifications,
)
)

.addTarget(targets.cloudwatch(
alias = 'Memory (Max)',
Expand Down
1 change: 1 addition & 0 deletions terraform/monitoring/panels/lb/error_5xx.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ local _configuration = defaults.configuration.timeseries
)

.setAlert(
vars.environment,
grafana.alert.new(
namespace = vars.namespace,
name = "%(env)s - 5XX alert" % { env: grafana.utils.strings.capitalize(vars.environment) },
Expand Down

0 comments on commit d9ef9e8

Please sign in to comment.