Last active
February 16, 2017 20:58
-
-
Save hartfordfive/10f126d155313e0050b4 to your computer and use it in GitHub Desktop.
Top-like ElasticSearch status script
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
| #!/bin/bash | |
| clear | |
| function header { | |
| dt=$(date) | |
| printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - | |
| echo " EStop :: $1 :: Last Update - $dt" | |
| printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - | |
| } | |
| function health { | |
| while true | |
| do | |
| OUT=$(curl -s 'localhost:9200/_cat/health?v&ts=0') | |
| clear | |
| header 'Cluster Health' | |
| echo -ne "$OUT" | |
| sleep $1 | |
| #tput cuu1 | |
| #tput el | |
| #tput cuu1 | |
| #tput el | |
| done | |
| } | |
| function threadpool { | |
| while true | |
| do | |
| OUT=$(curl -s 'localhost:9200/_cat/thread_pool?v&ts=0') | |
| clear | |
| header 'Thread Pool' | |
| echo -ne "$OUT" | |
| sleep $1 | |
| done | |
| } | |
| function allocation { | |
| while true | |
| do | |
| OUT=$(curl -s 'localhost:9200/_cat/allocation?v&ts=0') | |
| clear | |
| header 'Disk Allocation' | |
| echo -ne "$OUT" | |
| sleep $1 | |
| done | |
| } | |
| function recovery { | |
| while true | |
| do | |
| OUT=$(curl -s 'localhost:9200/_cat/recovery?v') | |
| clear | |
| header 'Recovery' | |
| echo -ne "$OUT" | |
| sleep $1 | |
| done | |
| } | |
| if [ "$1" == "health" ]; then | |
| health $2 | |
| elif [ "$1" == "threadpool" ]; then | |
| threadpool $2 | |
| elif [ "$1" == "allocation" ]; then | |
| allocation $2 | |
| elif [ "$1" == "recovery" ]; then | |
| recovery $2 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment