resource "datadog_dashboard" "rds" { title = "${var.application} ${var.stage} RDS Database Dashboard" description = "This dashboard provides an overview of the standard AWS RDS integration (based on data collected from CloudWatch)" layout_type = "free" is_read_only = false widget { query_value_definition { request { q = "max:aws.rds.read_latency{dbinstanceidentifier:${local.dbidentifier}}" aggregator = "max" conditional_formats { comparator = "<" value = "2" palette = "white_on_green" } } autoscale = true precision = "1" text_align = "center" title = "Max read latency" title_size = 13 live_span = "1h" } widget_layout { height = 6 width = 16 x = 58 y = 7 } } widget { query_value_definition { request { q = "max:aws.rds.write_latency{dbinstanceidentifier:${local.dbidentifier}}" aggregator = "max" conditional_formats { comparator = "<" value = "2" palette = "white_on_green" } } autoscale = true precision = "1" text_align = "center" title = "Max write latency" title_size = 13 live_span = "1h" } widget_layout { height = 6 width = 16 x = 58 y = 0 } } widget { query_value_definition { request { q = "avg:aws.rds.read_iops{dbinstanceidentifier:${local.dbidentifier}}" aggregator = "avg" conditional_formats { comparator = "<" value = "2" palette = "white_on_green" } } autoscale = true precision = "1" text_align = "center" title = "Avarage read operation per second" title_size = 13 live_span = "1h" } widget_layout { height = 6 width = 15 x = 75 y = 0 } } widget { note_definition { content = "Replication lag" background_color = "gray" font_size = "18" text_align = "center" show_tick = true tick_edge = "right" tick_pos = "50%" } widget_layout { height = 14 width = 14 x = 0 y = 29 } } widget { note_definition { content = "Connections" background_color = "gray" font_size = "18" text_align = "center" show_tick = true tick_edge = "right" tick_pos = "50%" } widget_layout { height = 14 width = 14 x = 0 y = 14 } } widget { note_definition { content = "Compute" background_color = "gray" font_size = "18" text_align = "center" show_tick = true tick_edge = "right" tick_pos = "50%" } widget_layout { height = 14 width = 14 x = 0 y = 74 } } widget { note_definition { content = "RAM" background_color = "gray" font_size = "18" text_align = "center" show_tick = true tick_edge = "right" tick_pos = "50%" } widget_layout { height = 14 width = 14 x = 0 y = 89 } } widget { note_definition { content = "Disk" background_color = "gray" font_size = "18" text_align = "center" show_tick = true tick_edge = "right" tick_pos = "50%" } widget_layout { height = 14 width = 14 x = 94 y = 76 } } widget { note_definition { content = "Read\nOperations & Latency" background_color = "gray" font_size = "18" text_align = "center" show_tick = true tick_edge = "right" tick_pos = "50%" } widget_layout { height = 29 width = 14 x = 0 y = 44 } } widget { note_definition { content = "Write Operations\n & Latency" background_color = "gray" font_size = "18" text_align = "center" show_tick = true tick_edge = "right" tick_pos = "50%" } widget_layout { height = 29 width = 14 x = 94 y = 46 } } widget { timeseries_definition { title = "Replication lag by instance, top 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1h" request { #q = "top10(avg:aws.rds.replica_lag{$database} by {dbinstanceidentifier})" q = "top10(avg:aws.rds.replica_lag {dbinstanceidentifier:${local.dbidentifier}})" display_type = "line" style { palette = "warm" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 15 y = 29 } } widget { timeseries_definition { title = "Connections by instance, top 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "top10(max:aws.rds.database_connections{$database} by {dbinstanceidentifier})" display_type = "line" style { palette = "warm" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 15 y = 14 } } widget { timeseries_definition { title = "CPU by instance (%), top 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { #q = "top10(avg:aws.rds.cpuutilization{$database} by {dbinstanceidentifier})" q = "avg:aws.rds.cpuutilization.total{dbinstanceidentifier:${local.dbidentifier}}" display_type = "line" style { palette = "warm" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 15 y = 74 } } widget { timeseries_definition { title = "Read operations per second by instance, top 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "top10(avg:aws.rds.read_iops{$database} by {dbinstanceidentifier}.as_count())" display_type = "line" style { palette = "warm" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 15 y = 44 } } widget { timeseries_definition { title = "Read Latency by instance, top 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "top10(avg:aws.rds.read_latency{$database} by {dbinstanceidentifier})" display_type = "line" style { palette = "green" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 15 y = 59 } } widget { timeseries_definition { title = "Write operations per second by instance, top 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "top10(avg:aws.rds.write_iops{$database} by {dbinstanceidentifier}.as_rate())" display_type = "line" style { palette = "purple" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 109 y = 46 } } widget { timeseries_definition { title = "Write Latency by instance, top 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "top10(avg:aws.rds.write_latency{$database} by {dbinstanceidentifier})" display_type = "line" style { palette = "purple" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 109 y = 61 } } widget { timeseries_definition { title = "Available RAM by instance, bottom 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "avg:aws.rds.freeable_memory{$database} by {dbinstanceidentifier}" display_type = "line" style { palette = "cool" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 15 y = 89 } } widget { timeseries_definition { title = "Available Disk by instance, bottom 10 past day" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "avg:aws.rds.free_storage_space{$database} by {dbinstanceidentifier}" display_type = "line" style { palette = "grey" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 14 width = 42 x = 109 y = 76 } } widget { timeseries_definition { title = "Disk queue" title_size = 13 title_align = "left" show_legend = false live_span = "1d" request { q = "avg:aws.rds.disk_queue_depth{$database} by {dbinstanceidentifier}" display_type = "bars" style { palette = "warm" line_type = "dashed" line_width = "thin" } } } widget_layout { height = 18 width = 90 x = 94 y = 0 } } widget { toplist_definition { title = "Avg replication lag by instance past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.replica_lag{$database} by {dbinstanceidentifier}, 10, 'max', 'desc')" style { palette = "warm" } } } widget_layout { height = 14 width = 32 x = 58 y = 29 } } widget { toplist_definition { title = "Connections by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(max:aws.rds.database_connections{$database} by {dbinstanceidentifier}, 10, 'max', 'desc')" style { palette = "dog_classic" } } } widget_layout { height = 14 width = 32 x = 58 y = 14 } } widget { toplist_definition { title = "CPU by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.cpuutilization{$database} by {dbinstanceidentifier}, 10, 'mean', 'desc')" #display_type = "line" style { palette = "warm" } } } widget_layout { height = 14 width = 32 x = 58 y = 74 } } widget { toplist_definition { title = "Read operations /s by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.read_iops{$database} by {dbinstanceidentifier}, 10, 'mean', 'desc')" style { palette = "green" } } } widget_layout { height = 14 width = 32 x = 58 y = 44 } } widget { toplist_definition { title = "Read latency by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.read_latency{$database} by {dbinstanceidentifier}, 10, 'mean', 'desc')" style { palette = "green" } } } widget_layout { height = 14 width = 32 x = 58 y = 59 } } widget { toplist_definition { title = "Write operations per second by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.write_iops{$database} by {dbinstanceidentifier}, 10, 'mean', 'desc')" style { palette = "purple" } } } widget_layout { height = 14 width = 32 x = 152 y = 46 } } widget { toplist_definition { title = "Write latency by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.write_latency{$database} by {dbinstanceidentifier}, 10, 'mean', 'desc')" style { palette = "purple" } } } widget_layout { height = 14 width = 32 x = 152 y = 61 } } widget { toplist_definition { title = "Available RAM by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.freeable_memory{$database} by {dbinstanceidentifier}, 10, 'mean', 'desc')" style { palette = "cool" } } } widget_layout { height = 14 width = 32 x = 58 y = 89 } } widget { toplist_definition { title = "Available Disk by instance, past day" title_size = 13 title_align = "left" live_span = "1d" request { q = "top(avg:aws.rds.free_storage_space{$database} by {dbinstanceidentifier}, 10, 'mean', 'desc')" style { palette = "grey" } } } widget_layout { height = 14 width = 32 x = 152 y = 76 } } }