Quick gist for curling etcd metrics. There are better ways to get the metrics but I'm creating this gist anyway in case I need to reference this again later.
export etcd_endpoint=$(docker exec etcd netstat -lpna | grep \:2379 | grep tcp | grep LISTEN | tr -s " " | cut -d" " -f4)
{ for var in $(docker inspect --format '{{ .Config.Env }}' etcd | sed 's/[][]//g'); do
if [[ "$var" == *"ETCDCTL_CERT"* ]] || [[ "$var" == *"ETCDCTL_KEY"* ]]; then
export ${var}
fi
done }
{ if [[ $etcd_endpoint =~ ":::" ]]; then
curl -k --cert $ETCDCTL_CERT --key $ETCDCTL_KEY https://127.0.0.1:2379/metrics
else
curl -k --cert $ETCDCTL_CERT --key $ETCDCTL_KEY https://$etcd_endpoint/metrics
fi }