Let’s say we have an ALB, 2 namespaces and 1 running application in per namespace.

We wan’t to create a dashboard, named “Dev”.

Here is my code:

1locals { 2 load_balancer_custom = split("loadbalancer/", data.aws_lb.load_balancer_arn.arn)[1] 3 cluster_name = "dev" 4 namespace_1 = "test" 5 namespace_2 = "qa" 6} 7 8data "aws_lb" "load_balancer_arn" { 9 name = "alb-dev" 10} 11 12module "monitoring_dashboard" { 13 source = "dasmeta/monitoring/aws//modules/dashboard" 14 version = "1.2.3" 15 16 name = "Dev" 17 rows = [ 18 // This part is for Load Balancer 19 [ 20 { 21 type : "text/title" 22 text : "Requests" 23 } 24 ], 25 [ 26 { 27 type : "balancer/2xx", 28 balancer_arn : data.aws_lb.load_balancer_arn.arn 29 }, 30 { 31 type : "balancer/4xx", 32 balancer_arn : data.aws_lb.load_balancer_arn.arn 33 }, 34 { 35 type : "balancer/5xx", 36 balancer_arn : data.aws_lb.load_balancer_arn.arn 37 }, 38 { 39 type = "custom", 40 title = "Response Time + Volume", 41 metrics : [ 42 { 43 MetricNamespace = "AWS/ApplicationELB" 44 MetricName = "ProcessedBytes" 45 LoadBalancer = local.load_balancer_custom 46 }, 47 { 48 MetricNamespace = "AWS/ApplicationELB" 49 MetricName = "TargetResponseTime" 50 LoadBalancer = local.load_balancer_custom 51 } 52 ] 53 } 54 ], 55 56 //This is for 1-st application in namespace "test" 57 [ 58 { 59 type : "text/title" 60 text : "Test" 61 } 62 ], 63 [ 64 { 65 type : "container/cpu", 66 period : 300, 67 container : "application_1", 68 cluster : local.cluster_name, 69 namespace : local.namespace_1 70 }, 71 { 72 type : "container/memory", 73 period : 300, 74 container : "application_1", 75 cluster : local.cluster_name, 76 namespace : local.namespace_1 77 }, 78 { 79 type : "container/network", 80 period : 300, 81 container : "application_1", 82 cluster : local.cluster_name, 83 namespace : local.namespace_1 84 }, 85 { 86 type : "container/restarts", 87 period : 300, 88 container : "application_1", 89 cluster : local.cluster_name, 90 namespace : local.namespace_1 91 }, 92 ], 93 94 //And this is for 2-nd application in namespace "qa" 95 [ 96 { 97 type : "text/title" 98 text : "QA" 99 } 100 ], 101 [ 102 { 103 type : "container/cpu", 104 period : 300, 105 container : "application_2", 106 cluster : local.cluster_name, 107 namespace : local.namespace_2 108 }, 109 { 110 type : "container/memory", 111 period : 300, 112 container : "application_2", 113 cluster : local.cluster_name, 114 namespace : local.namespace_2 115 }, 116 { 117 type : "container/network", 118 period : 300, 119 container : "application_2", 120 cluster : local.cluster_name, 121 namespace : local.namespace_2 122 }, 123 { 124 type : "container/restarts", 125 period : 300, 126 container : "application_2", 127 cluster : local.cluster_name, 128 namespace : local.namespace_2 129 }, 130 ], 131 ] 132}



Dashboard with RDS / Postgresql widget

1locals = { 2 db_instance_identifier = "dev-db" 3} 4 5module "monitoring_dashboard" { 6 source = "dasmeta/monitoring/aws//modules/dashboard" 7 version = "1.2.3" 8 9 name = "Dev-RDS" 10 rows = [ 11 [ 12 { 13 type : "text/title" 14 text : "RDS / PostgreSQL" 15 } 16 ], 17 [ 18 { 19 type : "custom", 20 title : "Main Units", 21 height : 5 22 width : 12 23 metrics : [ 24 { 25 MetricNamespace = "AWS/RDS" 26 MetricName = "CPUUtilization" 27 DBInstanceIdentifier = local.db_instance_identifier 28 }, 29 { 30 MetricNamespace = "AWS/RDS" 31 MetricName = "FreeableMemory" 32 DBInstanceIdentifier = local.db_instance_identifier 33 }, 34 { 35 MetricNamespace = "AWS/RDS" 36 MetricName = "FreeStorageSpace" 37 DBInstanceIdentifier = local.db_instance_identifier 38 }, 39 { 40 MetricNamespace = "AWS/RDS" 41 MetricName = "DatabaseConnections" 42 DBInstanceIdentifier = local.db_instance_identifier 43 } 44 ] 45 }, 46 ] 47 ] 48}



Dashboard with RabbitMQ widget

1locals = { 2 broker_name = "dev-broker" 3} 4 5module "monitoring_dashboard" { 6 source = "dasmeta/monitoring/aws//modules/dashboard" 7 version = "1.2.3" 8 9 name = "Dev-MQ" 10 rows = [ 11 [ 12 { 13 type : "text/title" 14 text : "RabbitMQ" 15 } 16 ], 17 [ 18 { 19 type : "custom", 20 title : "Main Units", 21 height : 5 22 width : 12 23 metrics : [ 24 { 25 MetricNamespace = "AWS/AmazonMQ" 26 MetricName = "MessageCount" 27 Broker = local.broker_name 28 }, 29 { 30 MetricNamespace = "AWS/AmazonMQ" 31 MetricName = "ConsumerCount" 32 Broker = local.broker_name 33 }, 34 { 35 MetricNamespace = "AWS/AmazonMQ" 36 MetricName = "PublishRate" 37 Broker = local.broker_name 38 }, 39 { 40 MetricNamespace = "AWS/AmazonMQ" 41 MetricName = "AckRate" 42 Broker = local.broker_name 43 }, 44 ] 45 }, 46 ], 47 ] 48}