Last active
February 12, 2019 20:34
-
-
Save portante/c801acce8ae275fdcfc743b346981b13 to your computer and use it in GitHub Desktop.
A simple script to display the "health" of an ES cluster
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 | |
ES_URL='https://localhost:9200' | |
curl_get='curl -s -X GET --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key' | |
date | |
$curl_get $ES_URL/_cat/health?v | |
$curl_get $ES_URL/_cat/allocation?v\&h=node,host,ip,shards,disk.indices,disk.used,disk.avail,disk.total,disk.percent | |
# See https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-nodes.html for header meanings | |
$curl_get $ES_URL/_cat/nodes?v\&h=name,host,r,m,hc,hp,hm,rc,rp,rm,fdc,fdp,fdm,load,uptime | |
$curl_get $ES_URL/_cat/nodes?v\&h=name,host,r,m,fm,fe,qcm,qce,rcm,rce,rchc,rcmc,ft,ftt,rto,rti,sc,sm,siwm,siwmx,svmm | |
$curl_get $ES_URL/_cat/nodes?v\&h=name,host,r,m,gc,gto,gti,iic,iito,iiti,mc,mt,mtt,sfc,sfto,sfti,sqc,sqto,sqti | |
$curl_get $ES_URL/_cat/thread_pool?v\&h=host,bulk.rejected,bulk.completed,bulk.queue,bulk.queueSize,bulk.size,bulk.active,bulk.largest | |
$curl_get $ES_URL/_cat/thread_pool?v\&h=host,refresh.rejected,refresh.completed,refresh.queue,refresh.size,refresh.active,refresh.largest | |
$curl_get $ES_URL/_cat/thread_pool?v\&h=host,management.rejected,management.completed,management.queue,management.size,management.active,management.largest |
Here is an example from a cluster with unassigned shards:
Thu May 24 20:56:43 UTC 2018
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1527195403 20:56:43 logging-es red 3 3 5659 2828 0 0 12 0 - 99.8%
node host ip shards disk.indices disk.used disk.avail disk.total disk.percent
logging-es-data-master-gkvb8lj8 10.129.0.29 10.129.0.29 1576 27.4gb 135.2gb 1.8tb 1.9tb 6
logging-es-data-master-ml8zmsl7 10.128.0.77 10.128.0.77 2111 61.9gb 173.6gb 1.7tb 1.9tb 8
logging-es-data-master-zolfd11v 10.129.0.30 10.129.0.30 1972 49.3gb 160.4gb 1.8tb 1.9tb 7
UNASSIGNED 12
name host r m hc hp hm rc rp rm fdc fdp fdm load uptime
logging-es-data-master-gkvb8lj8 10.129.0.29 d * 16.3gb 53 30.7gb 153.4gb 98 157.2gb 14818 1 1048576 31.14 21.3h
logging-es-data-master-ml8zmsl7 10.128.0.77 d m 18.1gb 58 30.7gb 155.8gb 99 157.2gb 19916 1 1048576 23.57 21.1h
logging-es-data-master-zolfd11v 10.129.0.30 d m 21.2gb 69 30.7gb 153.4gb 98 157.2gb 17992 1 1048576 31.14 21.3h
name host r m fm fe qcm qce rcm rce rchc rcmc ft ftt rto rti sc sm siwm siwmx svmm
logging-es-data-master-gkvb8lj8 10.129.0.29 d * 0b 0 0b 0 0b 0 0 0 29950 44.7m 5557638 1.1d 7928 140.3mb 308.8mb 3.4gb 148.2kb
logging-es-data-master-ml8zmsl7 10.128.0.77 d m 0b 0 0b 0 0b 0 0 0 38451 1.2h 8177223 2.9d 10510 249.7mb 454mb 5gb 601.6kb
logging-es-data-master-zolfd11v 10.129.0.30 d m 0b 0 0b 0 0b 0 0 0 33444 1h 7602006 2.9d 9331 203.5mb 458.7mb 4.5gb 492.6kb
name host r m gc gto gti iic iito iiti mc mt mtt sfc sfto sfti sqc sqto sqti
logging-es-data-master-gkvb8lj8 10.129.0.29 d * 0 147 36ms 1 48861959 21h 7 599867 2d 0 22386 1.5s 0 22386 2.5s
logging-es-data-master-ml8zmsl7 10.128.0.77 d m 0 104 70ms 0 95514486 2.4d 9 944469 4.9d 0 22148 2.6s 0 22148 5.7s
logging-es-data-master-zolfd11v 10.129.0.30 d m 0 195 47ms 5 79627575 2.9d 2 903139 4.5d 0 10225 1.7s 0 10225 1.8s
host bulk.rejected bulk.completed bulk.queue bulk.queueSize bulk.size bulk.active bulk.largest
10.129.0.29 133901 10775966 0 50 32 0 32
10.128.0.77 2548220 21183026 43 50 32 32 32
10.129.0.30 480337 17562786 0 50 32 1 32
host refresh.rejected refresh.completed refresh.queue refresh.size refresh.active refresh.largest
10.129.0.29 0 5558012 4 10 10 10
10.128.0.77 0 8177729 0 10 0 10
10.129.0.30 0 7602586 0 10 3 10
host management.rejected management.completed management.queue management.size management.active management.largest
10.129.0.29 0 30634 0 5 1 5
10.128.0.77 0 28499 0 3 1 3
10.129.0.30 0 28564 0 3 1 3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is an example output from a healthy cluster: