Last active
June 4, 2024 07:31
-
-
Save toughIQ/ae299dd8ac4dffed4387c92f89bdf5a8 to your computer and use it in GitHub Desktop.
OpenShift ElasticSearch Health Status
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 | |
echo "Switching to Logging project" | |
oc project openshift-logging | |
echo | |
echo | |
# fetch one ELA pod to run queries against | |
es_pod=$(oc get pod --selector=component=elasticsearch --no-headers -o jsonpath='{range .items[?(@.status.phase=="Running")]}{.metadata.name}{"\n"}{end}' | head -n1) | |
echo | |
echo "### ES Status ###" | |
oc exec -n openshift-logging -c elasticsearch $es_pod -- curl -s -k --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key https://localhost:9200/_cat/thread_pool?v\&h=name,host,completed,active,queue,rejected | |
echo | |
echo | |
echo "### Indices ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cat/indices?s=store.size:desc,index:asc | |
echo | |
echo | |
echo "### Allocation ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cluster/allocation/explain?pretty | |
echo | |
echo | |
echo "### Shards ###" | |
oc exec $es_pod -- curl -s --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca https://localhost:9200/_cat/shards?v | |
echo | |
echo | |
echo "### Unassigned Shards ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cat/shards?h=index,shard,prirep,state,unassigned.reason,node | grep UNASSIGNED | |
echo | |
echo | |
echo "### Health ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cat/health?v | |
echo | |
echo | |
echo "### Nodes ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cat/nodes?v | |
echo | |
echo | |
echo "### Utilization ###" | |
oc exec -c elasticsearch $es_pod -- curl -s --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca https://localhost:9200/_cat/allocation?v | |
echo | |
echo | |
echo "### Pending Tasks ###" | |
oc exec -c elasticsearch $es_pod -- curl -s --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca https://localhost:9200/_cluster/pending_tasks | |
echo | |
echo | |
echo "### Recovery ###" | |
oc exec -c elasticsearch $es_pod -- curl -s --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca https://localhost:9200/_cat/recovery?v | |
echo | |
echo | |
echo "### Thread Pool ###" | |
oc exec -c elasticsearch $es_pod -- curl -s --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca https://localhost:9200/_cat/thread_pool?v\&h=host,bulk.completed,bulk.rejected,bulk.queue,bulk.active,bulk.queueSize | |
echo | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment