O'Reilly logo

The DevOps 2.2 Toolkit by Viktor Farcic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating alerts based on metrics

Let us create the first alert. We'll update our go-demo_main service by adding a few labels:

docker service update \ 
    --label-add com.df.alertName=mem \  
    --label-add com.df.alertIf='container_memory_usage_\bytes{container_label_com_docker_swarm_service_name=\"go-demo_main"} > 20000000' \  
    go-demo_main 
Normally, we should have labels defined inside our stack file. However, since we'll do quite a few iterations with different values, we'll be updating the service instead modifying the stack file. That way we'll be able to iterate faster.

The label com.df.alertName is the name of the alert. It will be prefixed with the name of the service stripped from underscores and dashes (godemomem). That way, a unique alert ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required