#!/bin/bash service=$1 if [ -z "${service}" ]; then exit 1 fi zone="${2:-smf1}" metric=$(cqlmetrics "${service}" "${zone}") query="zone(${zone}, ts(${service}, members(sd.${service}), ${metric}))" short_id=$(curl -s --negotiate -u : -X POST https://monitoring.twitter.biz/api/2/url/shortener --data "{\"longUrl\":\"/query?&queries=%5B%7B%22id%22%3A%22query-1%22%2C%22name%22%3A%22Query%201%22%2C%22query%22%3A%22$query%22%2C%22settings%22%3A%7B%22visible%22%3Atrue%7D%7D%5D\"}" | jq '.id') echo "http://monitoring.twitter.biz/tiny/${short_id}" open "http://monitoring.twitter.biz/tiny/${short_id}"