Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
chmod +x scripts/dm-swarm-06.sh
./scripts/dm-swarm-06.sh
eval $(docker-machine env swarm-1)
open "http://$(docker-machine ip swarm-1)/monitor"
echo 'route:
receiver: "slack"
repeat_interval: 1h
receivers:
- name: "slack"
slack_configs:
- send_resolved: true
text: "Something horrible happened! Run for your lives!"
api_url: "https://hooks.slack.com/services/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"
' | docker secret create alert_manager_config -
docker stack deploy \
-c stacks/alert-manager-slack.yml \
alert-manager
curl -H "Content-Type: application/json" \
-d '[{"labels":{"alertname":"My Fancy Alert"}}]' \
$(docker-machine ip swarm-1):9093/api/v1/alerts
docker stack rm alert-manager
DOMAIN=$(docker-machine ip swarm-1) \
docker stack deploy \
-c stacks/docker-flow-monitor-slack.yml \
monitor
open "http://$(docker-machine ip swarm-1)/monitor/flags"
docker service update \
--label-add com.df.alertIf=@service_mem_limit:0.1 \
go-demo_main
open "http://$(docker-machine ip swarm-1)/monitor/alerts"
docker service update \
--label-add com.df.alertIf=@service_mem_limit:0.8 \
go-demo_main
open "http://$(docker-machine ip swarm-1)/monitor/alerts"
docker service rm monitor_alert-manager
docker secret rm alert_manager_config
echo "route:
group_by: [service]
receiver: 'slack'
repeat_interval: 1h
receivers:
- name: 'slack'
slack_configs:
- send_resolved: true
title: '[{{ .Status | toUpper }}] {{ .GroupLabels.service }} service is in danger!'
title_link: 'http://$(docker-machine ip swarm-1)/monitor/alerts'
text: '{{ .CommonAnnotations.summary}}'
api_url: 'https://hooks.slack.com/services/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'
" | docker secret create alert_manager_config -
DOMAIN=$(docker-machine ip swarm-1) \
docker stack deploy \
-c stacks/docker-flow-monitor-slack.yml \
monitor
docker service update \
--label-add com.df.alertIf=@service_mem_limit:0.1 \
go-demo_main
open "http://$(docker-machine ip swarm-1)/monitor/alerts"
docker service update \
--label-add com.df.alertIf=@service_mem_limit:0.8 \
go-demo_main
docker-machine rm -f swarm-1 swarm-2 swarm-3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.