annotate scripts/metrics.sh @ 206:5c36bfba7014

DEP-12: script to dump application metrics and thread dumps to stdout
author smith@nwoca.org
date Tue, 26 Sep 2017 20:49:48 +0100
parents scripts/capture.sh@fea886ba7279
children 9afc8cb478f6
rev   line source
55
77ff739c078d add script to provide shortened docker ps with ssdt labels
smith@nwoca.org
parents:
diff changeset
1 #!/bin/bash
206
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
2 # Dump application metrics and thread stacks to console.
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
3 #
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
4
191
fea886ba7279 DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents: 159
diff changeset
5 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
fea886ba7279 DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents: 159
diff changeset
6
206
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
7 container=$(composeGetContainer ${1?"Must specify the app service to connect to"} )
159
303259c08b7d DEP-12: update backup scripts
smith@nwoca.org
parents: 85
diff changeset
8
206
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
9 project=$(composeGetProject ${1} )
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
10 ip=$(docker inspect -f "{{with .NetworkSettings.Networks}}{{.${project}_default.IPAddress}}{{end}}" $container)
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
11
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
12 echo "connecting to ${container} in ${project} at ${ip}:8080"
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
13 docker run --network ${project}_default --rm docker.ssdt.io/ssdt-utils curl -s http://${ip}:8080/metrics/admin/metrics?pretty=true
5c36bfba7014 DEP-12: script to dump application metrics and thread dumps to stdout
smith@nwoca.org
parents: 191
diff changeset
14 docker run --network ${project}_default --rm docker.ssdt.io/ssdt-utils curl -s http://${ip}:8080/metrics/admin/threads