How to get the disc space of all Elasticsearch nodes from browser ?
To get the disk space information of all Elasticsearch nodes from a browser, interact with the Elasticsearch REST API. Here’s a step-by-step guide on how to achieve this:
1. Ensure Elasticsearch is Accessible
Make sure Elasticsearch is accessible from the browser. A HTTP requests to the Elasticsearch cluster’s REST API endpoint should be possible.
2. Access the _cat
API
Elasticsearch provides a _cat
API that is very user-friendly for getting cluster-wide information in a human-readable format. For disk space information, use the _cat/nodes
API.
3. Make the Request
Open the browser and navigate to the following URL, replacing localhost
with the Elasticsearch server’s address and 9200
with the correct port if it differs:
bash http://localhost:9200/_cat/nodes?v&h=id,ip,disk.total,disk.used,disk.free
v
makes the output verbose with headers.h=id,ip,disk.total,disk.used,disk.free
specifies the columns to be seen.
4. Interpret the Response
The response will look something like this:
bash id ip disk.total disk.used disk.free node1 192.168.1.1 100GB 60GB 40GB node2 192.168.1.2 100GB 70GB 30GB
Here’s what each column means:
id
: The node ID.ip
: The IP address of the node.disk.total
: The total disk space of the node.disk.used
: The disk space used.disk.free
: The disk space free.
Alternative Method: Using Kibana
If Kibana is set up, this information can also be retrieved through its UI:
-
Open Kibana and go to the Dev Tools section.
-
Run the following query:
GET /_cat/nodes?v&h=id,ip,disk.total,disk.used,disk.free
-
View the Results in the console.
Additional Notes
- Permissions: Ensure the appropriate permissions are granted to access Elasticsearch’s API if security is enabled.
- CORS: If requests are made from a browser directly, ensure Elasticsearch is configured to handle CORS requests if necessary.
Further brief
N = node name
I = ip address
Dt = total disk space
Du - disk used
D - disk available
E.g.: http://ES_URL.com/_cat/node?v&h=n,i,dt,du,d