diff --git a/terraform/monitoring/dashboard.jsonnet b/terraform/monitoring/dashboard.jsonnet index 8d5b6b43..5ad3315a 100644 --- a/terraform/monitoring/dashboard.jsonnet +++ b/terraform/monitoring/dashboard.jsonnet @@ -71,6 +71,13 @@ dashboard.new( panels.ecs.cpu(ds, vars) { gridPos: pos._2 }, panels.ecs.memory(ds, vars) { gridPos: pos._2 }, + ////////////////////////////////////////////////////////////////////////////// + row.new('RDS'), + panels.rds.cpu(ds, vars) { gridPos: pos._4 }, + panels.rds.freeable_memory(ds, vars) { gridPos: pos._4 }, + panels.rds.volume_bytes_used(ds, vars) { gridPos: pos._4 }, + panels.rds.database_connections(ds, vars) { gridPos: pos._4 }, + ////////////////////////////////////////////////////////////////////////////// row.new('DocumentDB'), panels.db.available_memory(ds, vars) { gridPos: pos._3 }, diff --git a/terraform/monitoring/panels/panels.libsonnet b/terraform/monitoring/panels/panels.libsonnet index d4033c7b..dc29caf5 100644 --- a/terraform/monitoring/panels/panels.libsonnet +++ b/terraform/monitoring/panels/panels.libsonnet @@ -21,6 +21,16 @@ local docdb_mem_threshold = units.size_bin(GiB = docdb_mem * 0.1); http_requests: (import 'app/http_requests.libsonnet' ).new, http_request_latency: (import 'app/http_request_latency.libsonnet' ).new, }, + ecs: { + cpu(ds, vars): ecs.cpu.panel(ds.cloudwatch, vars.namespace, vars.environment, vars.notifications, vars.ecs_service_name, vars.ecs_cluster_name), + memory(ds, vars): ecs.memory.panel(ds.cloudwatch, vars.namespace, vars.environment, vars.notifications, vars.ecs_service_name, vars.ecs_cluster_name), + }, + rds: { + cpu(ds, vars): (import 'rds/cpu.libsonnet' ).new, + freeable_memory(ds, vars): (import 'rds/freeable_memory.libsonnet' ).new, + volume_bytes_used(ds, vars): (import 'rds/volume_bytes_used.libsonnet' ).new, + database_connections(ds, vars): (import 'rds/database_connections.libsonnet' ).new, + }, db: { available_memory(ds, vars): docdb.available_memory.panel(ds.cloudwatch, vars.namespace, vars.environment, vars.notifications, vars.docdb_cluster_id, mem_threshold = docdb_mem_threshold), buffer_cache_hit_ratio(ds, vars): docdb.buffer_cache_hit_ratio.panel(ds.cloudwatch, vars.docdb_cluster_id), @@ -31,10 +41,6 @@ local docdb_mem_threshold = units.size_bin(GiB = docdb_mem * 0.1); volume(ds, vars): docdb.volume.panel(ds.cloudwatch, vars.docdb_cluster_id), write_latency(ds, vars): docdb.write_latency.panel(ds.cloudwatch, vars.docdb_cluster_id), }, - ecs: { - cpu(ds, vars): ecs.cpu.panel(ds.cloudwatch, vars.namespace, vars.environment, vars.notifications, vars.ecs_service_name, vars.ecs_cluster_name), - memory(ds, vars): ecs.memory.panel(ds.cloudwatch, vars.namespace, vars.environment, vars.notifications, vars.ecs_service_name, vars.ecs_cluster_name), - }, lb: { active_connections: (import 'lb/active_connections.libsonnet' ).new, error_4xx: (import 'lb/error_4xx.libsonnet' ).new, diff --git a/terraform/monitoring/panels/rds/cpu.libsonnet b/terraform/monitoring/panels/rds/cpu.libsonnet new file mode 100644 index 00000000..2ef83a67 --- /dev/null +++ b/terraform/monitoring/panels/rds/cpu.libsonnet @@ -0,0 +1,21 @@ +local grafana = import '../../grafonnet-lib/grafana.libsonnet'; +local defaults = import '../../grafonnet-lib/defaults.libsonnet'; + +local panels = grafana.panels; +local targets = grafana.targets; + +{ + new(ds, vars):: + panels.timeseries( + title = 'CPU', + datasource = ds.cloudwatch, + ) + .configure(defaults.configuration.timeseries) + + .addTarget(targets.cloudwatch( + datasource = ds.cloudwatch, + namespace = 'AWS/RDS', + metricName = 'CPUUtilization', + statistics = 'Average', + )) +} diff --git a/terraform/monitoring/panels/rds/database_connections.libsonnet b/terraform/monitoring/panels/rds/database_connections.libsonnet new file mode 100644 index 00000000..65077840 --- /dev/null +++ b/terraform/monitoring/panels/rds/database_connections.libsonnet @@ -0,0 +1,21 @@ +local grafana = import '../../grafonnet-lib/grafana.libsonnet'; +local defaults = import '../../grafonnet-lib/defaults.libsonnet'; + +local panels = grafana.panels; +local targets = grafana.targets; + +{ + new(ds, vars):: + panels.timeseries( + title = 'Connections', + datasource = ds.cloudwatch, + ) + .configure(defaults.configuration.timeseries) + + .addTarget(targets.cloudwatch( + datasource = ds.cloudwatch, + namespace = 'AWS/RDS', + metricName = 'DatabaseConnections', + statistics = 'Average', + )) +} diff --git a/terraform/monitoring/panels/rds/freeable_memory.libsonnet b/terraform/monitoring/panels/rds/freeable_memory.libsonnet new file mode 100644 index 00000000..285d8e8e --- /dev/null +++ b/terraform/monitoring/panels/rds/freeable_memory.libsonnet @@ -0,0 +1,24 @@ +local grafana = import '../../grafonnet-lib/grafana.libsonnet'; +local defaults = import '../../grafonnet-lib/defaults.libsonnet'; + +local panels = grafana.panels; +local targets = grafana.targets; + +{ + new(ds, vars):: + panels.timeseries( + title = 'Freeable Memory', + datasource = ds.cloudwatch, + ) + .configure( + defaults.configuration.timeseries + .withUnit(grafana.fieldConfig.units.DecBytes) + ) + + .addTarget(targets.cloudwatch( + datasource = ds.cloudwatch, + namespace = 'AWS/RDS', + metricName = 'FreeableMemory', + statistics = 'Average', + )) +} diff --git a/terraform/monitoring/panels/rds/volume_bytes_used.libsonnet b/terraform/monitoring/panels/rds/volume_bytes_used.libsonnet new file mode 100644 index 00000000..80118035 --- /dev/null +++ b/terraform/monitoring/panels/rds/volume_bytes_used.libsonnet @@ -0,0 +1,24 @@ +local grafana = import '../../grafonnet-lib/grafana.libsonnet'; +local defaults = import '../../grafonnet-lib/defaults.libsonnet'; + +local panels = grafana.panels; +local targets = grafana.targets; + +{ + new(ds, vars):: + panels.timeseries( + title = 'Volume Used', + datasource = ds.cloudwatch, + ) + .configure( + defaults.configuration.timeseries + .withUnit(grafana.fieldConfig.units.DecBytes) + ) + + .addTarget(targets.cloudwatch( + datasource = ds.cloudwatch, + namespace = 'AWS/RDS', + metricName = 'VolumeBytesUsed', + statistics = 'Average', + )) +}