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:
locals = { load_balancer_custom = split("loadbalancer/", data.aws_lb.load_balancer_arn.arn)[1] cluster_name = "dev" namespace_1 = "test" namespace_2 = "qa" } data "aws_lb" "load_balancer_arn" { name = "alb-dev" } module "monitoring_dashboard" { source = "dasmeta/monitoring/aws//modules/dashboard" version = "1.2.3" name = "Dev" rows = [ // This part is for Load Balancer [ { type : "text/title" text : "Requests" } ], [ { type : "balancer/2xx", balancer_arn : data.aws_lb.load_balancer_arn.arn }, { type : "balancer/4xx", balancer_arn : data.aws_lb.load_balancer_arn.arn }, { type : "balancer/5xx", balancer_arn : data.aws_lb.load_balancer_arn.arn }, { type = "custom", title = "Response Time + Volume", metrics : [ { MetricNamespace = "AWS/ApplicationELB" MetricName = "ProcessedBytes" LoadBalancer = local.load_balancer_custom }, { MetricNamespace = "AWS/ApplicationELB" MetricName = "TargetResponseTime" LoadBalancer = local.load_balancer_custom } ] } ], //This is for 1-st application in namespace "test" [ { type : "text/title" text : "Test" } ], [ { type : "container/cpu", period : 300, container : "application_1", cluster : local.cluster_name, namespace : local.namespace_1 }, { type : "container/memory", period : 300, container : "application_1", cluster : local.cluster_name, namespace : local.namespace_1 }, { type : "container/network", period : 300, container : "application_1", cluster : local.cluster_name, namespace : local.namespace_1 }, { type : "container/restarts", period : 300, container : "application_1", cluster : local.cluster_name, namespace : local.namespace_1 }, ], //And this is for 2-nd application in namespace "qa" [ { type : "text/title" text : "QA" } ], [ { type : "container/cpu", period : 300, container : "application_2", cluster : local.cluster_name, namespace : local.namespace_2 }, { type : "container/memory", period : 300, container : "application_2", cluster : local.cluster_name, namespace : local.namespace_2 }, { type : "container/network", period : 300, container : "application_2", cluster : local.cluster_name, namespace : local.namespace_2 }, { type : "container/restarts", period : 300, container : "application_2", cluster : local.cluster_name, namespace : local.namespace_2 }, ], ] }
Add Comment