diff --git a/terraform/monitoring/grafonnet-lib b/terraform/monitoring/grafonnet-lib index 343c394..b085843 160000 --- a/terraform/monitoring/grafonnet-lib +++ b/terraform/monitoring/grafonnet-lib @@ -1 +1 @@ -Subproject commit 343c39494ec8f1561af5c158010dafc71fbb1351 +Subproject commit b085843dd64a0c8426f6f5cbd616fc1438379235 diff --git a/terraform/monitoring/panels/app/app_metric.libsonnet b/terraform/monitoring/panels/app/app_metric.libsonnet index 922172c..7184c26 100644 --- a/terraform/monitoring/panels/app/app_metric.libsonnet +++ b/terraform/monitoring/panels/app/app_metric.libsonnet @@ -1,9 +1,8 @@ local grafana = import '../../grafonnet-lib/grafana.libsonnet'; +local defaults = import '../../grafonnet-lib/defaults.libsonnet'; local panels = grafana.panels; local targets = grafana.targets; -local defaults = import '../defaults.libsonnet'; - { new(ds, vars, title, metric_name, metric_label):: panels.timeseries( diff --git a/terraform/monitoring/panels/defaults.libsonnet b/terraform/monitoring/panels/defaults.libsonnet index ab2a58d..1aad0b2 100644 --- a/terraform/monitoring/panels/defaults.libsonnet +++ b/terraform/monitoring/panels/defaults.libsonnet @@ -76,11 +76,5 @@ local grafana = import '../grafonnet-lib/grafana.libsonnet'; color : 'red', value : 50 }), - - timeseries_tr80:: self.timeseries - .addThreshold({ - color : 'red', - value : 80 - }), }, } diff --git a/terraform/monitoring/panels/docdb/available_memory.libsonnet b/terraform/monitoring/panels/docdb/available_memory.libsonnet index 5981723..7dd653a 100644 --- a/terraform/monitoring/panels/docdb/available_memory.libsonnet +++ b/terraform/monitoring/panels/docdb/available_memory.libsonnet @@ -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', diff --git a/terraform/monitoring/panels/docdb/cpu.libsonnet b/terraform/monitoring/panels/docdb/cpu.libsonnet index 7815cb1..6fa6803 100644 --- a/terraform/monitoring/panels/docdb/cpu.libsonnet +++ b/terraform/monitoring/panels/docdb/cpu.libsonnet @@ -32,8 +32,11 @@ local cpu_alert(vars) = alert.new( title = 'CPU Utilization', datasource = ds.cloudwatch, ) - .configure(defaults.configuration.timeseries_resource) - .setAlert(cpu_alert(vars)) + .configure(defaults.configuration.timeseries) + .setAlert( + vars.environment, + cpu_alert(vars) + ) .addTarget(targets.cloudwatch( refId = 'CPU_Max', diff --git a/terraform/monitoring/panels/docdb/low_mem_op_throttled.libsonnet b/terraform/monitoring/panels/docdb/low_mem_op_throttled.libsonnet index 7ea7d99..2f6702b 100644 --- a/terraform/monitoring/panels/docdb/low_mem_op_throttled.libsonnet +++ b/terraform/monitoring/panels/docdb/low_mem_op_throttled.libsonnet @@ -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)', diff --git a/terraform/monitoring/panels/ecs/cpu.libsonnet b/terraform/monitoring/panels/ecs/cpu.libsonnet index 22ae5b0..cf0a12a 100644 --- a/terraform/monitoring/panels/ecs/cpu.libsonnet +++ b/terraform/monitoring/panels/ecs/cpu.libsonnet @@ -11,13 +11,16 @@ local overrides = defaults.overrides; title = 'CPU Utilization', datasource = ds.cloudwatch, ) - .configure(overrides.cpu(defaults.configuration.timeseries_resource)) - .setAlert(defaults.alerts.cpu( - namespace = vars.namespace, - title = 'ECS', - env = vars.environment, - notifications = vars.notifications, - )) + .configure(overrides.cpu(defaults.configuration.timeseries)) + .setAlert( + vars.environment, + defaults.alerts.cpu( + namespace = vars.namespace, + title = 'ECS', + env = vars.environment, + notifications = vars.notifications, + ) + ) .addTarget(targets.cloudwatch( alias = 'CPU (Max)', diff --git a/terraform/monitoring/panels/ecs/memory.libsonnet b/terraform/monitoring/panels/ecs/memory.libsonnet index 045f0b0..067de7d 100644 --- a/terraform/monitoring/panels/ecs/memory.libsonnet +++ b/terraform/monitoring/panels/ecs/memory.libsonnet @@ -10,14 +10,17 @@ local targets = grafana.targets; title = 'Memory Utilization', datasource = ds.cloudwatch, ) - .configure(defaults.overrides.memory(defaults.configuration.timeseries_resource)) + .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)', diff --git a/terraform/monitoring/panels/lb/error_4xx.libsonnet b/terraform/monitoring/panels/lb/error_4xx.libsonnet index 15ae59f..6cc41e8 100644 --- a/terraform/monitoring/panels/lb/error_4xx.libsonnet +++ b/terraform/monitoring/panels/lb/error_4xx.libsonnet @@ -11,7 +11,7 @@ local _configuration = defaults.configuration.timeseries axisSoftMin = 0, axisSoftMax = threshold * 1.2, ) - .withThresholdStyle(grafana.fieldConfig.thresholdStyle.dashed) + .withThresholdStyle(grafana.fieldConfig.thresholdStyle.Dashed) .addThreshold({ color : defaults.values.colors.critical, value : threshold, @@ -29,7 +29,7 @@ local _configuration = defaults.configuration.timeseries axisSoftMin = 0, axisSoftMax = threshold * 1.2, ) - .withThresholdStyle(grafana.fieldConfig.thresholdStyle.dashed) + .withThresholdStyle(grafana.fieldConfig.thresholdStyle.Dashed) .addThreshold({ color : defaults.values.colors.critical, value : threshold, diff --git a/terraform/monitoring/panels/lb/error_5xx.libsonnet b/terraform/monitoring/panels/lb/error_5xx.libsonnet index 3c9ca3b..2cdef66 100644 --- a/terraform/monitoring/panels/lb/error_5xx.libsonnet +++ b/terraform/monitoring/panels/lb/error_5xx.libsonnet @@ -11,7 +11,7 @@ local _configuration = defaults.configuration.timeseries axisSoftMin = 0, axisSoftMax = threshold * 1.2, ) - .withThresholdStyle(grafana.fieldConfig.thresholdStyle.dashed) + .withThresholdStyle(grafana.fieldConfig.thresholdStyle.Dashed) .addThreshold({ color : defaults.values.colors.critical, value : threshold, @@ -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) }, diff --git a/terraform/monitoring/panels/lb/healthy_hosts.libsonnet b/terraform/monitoring/panels/lb/healthy_hosts.libsonnet index 67c9952..91f191f 100644 --- a/terraform/monitoring/panels/lb/healthy_hosts.libsonnet +++ b/terraform/monitoring/panels/lb/healthy_hosts.libsonnet @@ -20,7 +20,7 @@ local _configuration = defaults.configuration.timeseries .addTarget(targets.cloudwatch( datasource = ds.cloudwatch, - metricQueryType = grafana.target.cloudwatch.metricQueryTypes.query, + metricQueryType = grafana.target.cloudwatch.queryTypes.Query, dimensions = { TargetGroup: vars.target_group