Skip to content

Instantly share code, notes, and snippets.

@reutsharabani
Last active March 10, 2021 09:16
Show Gist options
  • Save reutsharabani/fd128ec25786a91e18557afe79e29171 to your computer and use it in GitHub Desktop.
Save reutsharabani/fd128ec25786a91e18557afe79e29171 to your computer and use it in GitHub Desktop.
# NLBs followed ALBs.
# All this does is divides healthy by total (once for NLB and once for ALB) and formats them nicely.
label_replace(
aws_networkelb_healthy_host_count_average offset 15m / (aws_networkelb_healthy_host_count_average offset 15m + aws_networkelb_un_healthy_host_count_average offset 15m),
"target_group",
"$2-$3",
"target_group",
"targetgroup/k8s-([A-Za-z]+)-([A-Za-z]+)-([A-Za-z0-9]+)/(.*)"
)
or
label_replace(
aws_applicationelb_healthy_host_count_average offset 15m / (aws_applicationelb_healthy_host_count_average offset 15m + aws_applicationelb_un_healthy_host_count_average offset 15m),
"target_group",
"$2-$3",
"target_group",
"targetgroup/k8s-([A-Za-z]+)-([A-Za-z]+)-([A-Za-z0-9]+)/(.*)"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment