Last active
May 9, 2023 14:34
-
-
Save toughIQ/4fe7dc19d05684d49d1bd652db6dc640 to your computer and use it in GitHub Desktop.
Script shows operational values of OCP ElasticSearch within the Logging stack
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 | |
echo "Switching to openshift-logging project" | |
oc project openshift-logging | |
echo | |
echo "### Pods ###" | |
oc get pods -owide|grep elasticsearch-c | |
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 "### Health ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cat/health?v | |
echo | |
echo "### Nodes ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cat/nodes?v | |
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 "### 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 "### Indices ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cat/indices?s=store.size:desc,index:asc | |
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 "### Allocation ###" | |
oc exec -c elasticsearch $es_pod -- es_util --query=_cluster/allocation/explain?pretty | |
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 "### 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 "### 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 "### 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment