Created
May 10, 2022 16:30
-
-
Save mrballcb/de5330ca6228907a170842c2d4b8d182 to your computer and use it in GitHub Desktop.
Summary view of ELK cluster
This file contains 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
#!/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