Skip to content

Instantly share code, notes, and snippets.

@portante
Last active September 14, 2017 03:11
Show Gist options
  • Save portante/0b294318c68dc362481e2994b9030200 to your computer and use it in GitHub Desktop.
Save portante/0b294318c68dc362481e2994b9030200 to your computer and use it in GitHub Desktop.
A simple script to check the state of Elasticsearch from within an ES pod in an OpenShift cluster
#!/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/nodes?v
$curl_get $ES_URL/_cat/indices?v 2>&1 | grep -vE "^green"
$curl_get $ES_URL/_cat/indices?v 2>&1 | grep "searchguard"
$curl_get $ES_URL/_cat/count?v
sleep 5
$curl_get $ES_URL/_cat/count?v
date
@portante
Copy link
Author

The following lists all the known indices and their state in the cluster:

$curl_get $ES_URL/_cat/indices?v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment