Last active
October 27, 2016 16:00
-
-
Save ukn/d810cb8fa2c0c65aeefdbed5a4e8a326 to your computer and use it in GitHub Desktop.
bash function that gives nicely formated services status from consul
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ss() { | |
if [[ -z ${2+x} ]]; then | |
ssh ${1} "curl -s localhost:8500/v1/catalog/services | \ | |
jq -rc 'keys | .[]' | while read i; do curl -s localhost:8500/v1/health/service/\${i} | jq -r '.[] | .Checks[] | select(.CheckID != \"serfHealth\") | .ServiceName + \" \" + .CheckID + \" \" + .Status'; done | column -t -x" | |
else | |
ssh ${1} "curl -s localhost:8500/v1/health/service/${2} | jq -r '.[] | .Checks[] | select(.CheckID != \"serfHealth\") | .CheckID + \"\t\" + .Status + \"\t\t\" + .Output'" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment