A CLI tool that provides the data we need for optimizing opensearch performance
The following functions are supported:
- List Nodes
- Live monitoring for Nodes
- List Indices
- live monitoring for Indices
- show shards allocation over the nodes (for a giving Index pattern)
- generate Markdown table for indices patterns 🎉 NEW
At least Python 3.6 is needed
pip3 install opmcli --upgrade
If you see a similar warning:
WARNING: The script opmcli is installed in '/Users/YOU/Library/Python/3.8/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
You need to create an alias ( Prefered to put it in .bashrc
)
Example:
alias opmcli="/Users/YOU/Library/Python/3.8/bin/opmcli"
Build from source
[ optional ]
python setup.py sdist bdist_wheel
mv dist/opmcli-0.0.1-py2-none-any.whl dist/opmcli-0.0.1-py36-none-any.whl
pip3 install dist/opmcli-0.0.1-py36-none-any.whl
You need to provide the following Environment variables
export OPENSEARCH_ENDPOINT=
export OPENSEARCH_PORT=443
export OPENSEARCH_BASIC_AUTH=yes
export OPENSEARCH_USERNAME=
export OPENSEARCH_PASSWORD=
ENV | Required | Default value |
---|---|---|
OPENSEARCH_ENDPOINT |
YES | |
OPENSEARCH_PORT |
NO | 443 |
OPENSEARCH_BASIC_AUTH |
NO | no |
OPENSEARCH_USERNAME |
NO | |
OPENSEARCH_PASSWORD |
NO |
opmcli --list --index INDEX_PATTERN
opmcli --list --nodes
opmcli --top --node NODE_ID
- Monitored Metrics:
- cpu
- memory
- swap
- fs
- File_descriptors
- Disk IO
- JVM
- Indexing Rate
- Indexing Latency
- Searching Rate
- Searching Latency
- Fetch Rate
- Fetch Latency
- Refresh Rate
- Refresh Latency
- Field data
- Threads
More to be added upon need
opmcli --top --index INDEX_PATTERN
- Monitored Metrics:
- Store size
- documents count
- Indexing Rate
- Indexing Latency
- Searching Rate
- Searching Latency
- Fetch Rate
- Fetch Latency
- Refresh Rate
- Refresh Latency
- Field data
More to be added upon need
opmcli --list --index INDEX_PATTERN --display-shards
Generates a markdown table with helpful information for each index pattern (compatible with Jira confluence)
CLI options for --patterns
argument | description | options | default |
---|---|---|---|
--template-version |
which index template version to discover (supports 1 and 2(composable index templates)) | 1 , 2 |
2 |
sort-by |
sort the table indices patterns by size , indices or shards |
size , indices , shards |
Examples
opmcli --list --patterns test-* test2-* --sort-by size
cat all_indices_patterns.txt
#test-*
#test2-*
opmcli --list --patterns $(cat all_indices_patterns.txt)
Example output
Index pattern | Indices number | Shards number | Size total | Size P | Index Templates (v2) | ISM Policy | Comment |
---|---|---|---|---|---|---|---|
test1-* |
67 | 604 | 4.05 tb | 2.03 tb | ******* |
******* |
|
test2-* |
76 | 216 | 1.45 tb | 742.38 gb | ******* |
******* |
|
test3* |
9 | 18 | 186.49 mb | 93.35 mb | ******* |
🔍 NOT ENABLED |