From a308a39bbe6d9ab55ffb4de48f682a9aaeace469 Mon Sep 17 00:00:00 2001 From: Wes Date: Wed, 24 May 2023 16:48:45 +0000 Subject: [PATCH] Use disk space taken up by indices if the script is not running on a manager --- .../tools/sbin_jinja/so-elasticsearch-cluster-space-used | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-cluster-space-used b/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-cluster-space-used index b8ac4f6e6..222cb2f5d 100755 --- a/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-cluster-space-used +++ b/salt/elasticsearch/tools/sbin_jinja/so-elasticsearch-cluster-space-used @@ -12,9 +12,11 @@ TOTAL_AVAILABLE_SPACE=0 # Iterate through the output of _cat/allocation for each node in the cluster to determine the total available space {% if GLOBALS.role == 'so-manager' %} +# Get total disk space - disk.total for i in $(/usr/sbin/so-elasticsearch-query _cat/allocation | grep -v {{ GLOBALS.manager }} | awk '{print $3}'); do {% else %} -for i in $(/usr/sbin/so-elasticsearch-query _cat/allocation | awk '{print $3}'); do +# Get disk space taken up by indices - disk.indices +for i in $(/usr/sbin/so-elasticsearch-query _cat/allocation | awk '{print $2}'); do {% endif %} size=$(echo $i | grep -oE '[0-9].*' | awk '{print int($1+0.5)}') unit=$(echo $i | grep -oE '[A-Za-z]+')