Skip to content

Instantly share code, notes, and snippets.

@mrballcb
Created May 10, 2022 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrballcb/de5330ca6228907a170842c2d4b8d182 to your computer and use it in GitHub Desktop.
Save mrballcb/de5330ca6228907a170842c2d4b8d182 to your computer and use it in GitHub Desktop.
Summary view of ELK cluster
#!/bin/bash
function ssh_and_get_status {
SSH=$1
SSHARGS=$2
TARG=$3
ssh $SSHARGS $SSH "
echo
curl -s 'http://$TARG/_cat/nodes?v'
echo
curl -s 'http://$TARG/_cat/allocation?v'
echo
curl -s 'http://$TARG/_cat/health?v'
echo
curl -s 'http://$TARG/_cat/indices?v' | sort -r
echo
curl -s 'http://$TARG/_cat/shards?v' | grep -E "^index|RELOCATING"
"
}
case "$1" in
dev)
TARG=es-logs.dev.example.net
SSH=bastion-dev
SSHARGS=''
ssh_and_get_status "$SSH" "$SSHARGS" "$TARG"
;;
prod)
TARG=es-logs.prod.example.net
SSH=bastion-prod
SSHARGS=''
ssh_and_get_status "$SSH" "$SSHARGS" "$TARG"
;;
*)
echo "Error, either 'dev' or 'prod', didn't understand '$1'"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment