Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

fix: lb metrics #36

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions terraform/monitoring/dashboard.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dashboard.new(
panels.history.registrations(ds, vars) { gridPos: pos._1 },

row.new('Load Balancer'),
panels.lb.active_connections(ds, vars) { gridPos: pos._2 },
panels.lb.healthy_hosts(ds, vars) { gridPos: pos._2 },

row.new('Database'),
Expand Down
24 changes: 24 additions & 0 deletions terraform/monitoring/panels/lb/active_connections.libsonnet
Original file line number Diff line number Diff line change
@@ -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 = 'Active Connections',
datasource = ds.cloudwatch,
)
.configure(defaults.configuration.timeseries)

.addTarget(targets.cloudwatch(
datasource = ds.cloudwatch,
namespace = 'AWS/ApplicationELB',
metricName = 'ActiveConnectionCount',
dimensions = {
LoadBalancer: vars.load_balancer
},
statistic = 'Average',
))
}
7 changes: 3 additions & 4 deletions terraform/monitoring/panels/lb/healthy_hosts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ local _configuration = defaults.configuration.timeseries
.configure(_configuration)

.addTarget(targets.cloudwatch(
alias = "eu-central-1",
datasource = ds.cloudwatch,
metricQueryType = grafana.target.cloudwatch.metricQueryTypes.query,

dimensions = {
TargetGroup: vars.target_group
},
metricName = 'HealthyHostCount',
namespace = 'AWS/NetworkELB',
namespace = 'AWS/ApplicationELB',
sql = {
from: {
property: {
name: "AWS/NetworkELB",
name: "AWS/ApplicationELB",
type: "string"
},
type: "property"
Expand Down Expand Up @@ -63,7 +62,7 @@ local _configuration = defaults.configuration.timeseries
type: "and"
}
},
sqlExpression = "SELECT MAX(HealthyHostCount) FROM \"AWS/NetworkELB\" WHERE LoadBalancer = '%s'" % [vars.load_balancer],
sqlExpression = "SELECT MAX(HealthyHostCount) FROM \"AWS/ApplicationELB\" WHERE LoadBalancer = '%s'" % [vars.load_balancer],
statistic = 'Maximum',
))
}
1 change: 1 addition & 0 deletions terraform/monitoring/panels/panels.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},

lb: {
active_connections: (import 'lb/active_connections.libsonnet' ).new,
healthy_hosts: (import 'lb/healthy_hosts.libsonnet' ).new,
}
}