Skip to content

Instantly share code, notes, and snippets.

@prologic
Created January 5, 2022 02:12
Show Gist options
  • Save prologic/230c9df347ffb19b048a3f9822083ccd to your computer and use it in GitHub Desktop.
Save prologic/230c9df347ffb19b048a3f9822083ccd to your computer and use it in GitHub Desktop.
PromQL to measure (for Docker containers via cAdvisor) Network Traffic
sum(label_replace(
increase(container_network_transmit_bytes_total{image!="", container_label_com_docker_stack_namespace=~"$stack", container_label_com_docker_swarm_service_name=~"$service"}[$__range])
+
increase(container_network_receive_bytes_total{image!="", container_label_com_docker_stack_namespace=~"$stack", container_label_com_docker_swarm_service_name=~"$service"}[$__range]),
"task_name", "$1", "container_label_com_docker_swarm_task_name", "(.*\\.[0-9]*).*\\..*")) by (task_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment