From 74840264d74929307c65fe3372c94c8cb54cf989 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Tue, 28 Mar 2023 11:49:05 -0400 Subject: [PATCH] Update so-elasticsearch-cluster-space-used --- salt/common/tools/sbin/so-elasticsearch-cluster-space-used | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/salt/common/tools/sbin/so-elasticsearch-cluster-space-used b/salt/common/tools/sbin/so-elasticsearch-cluster-space-used index dbc35440d..b8ac4f6e6 100755 --- a/salt/common/tools/sbin/so-elasticsearch-cluster-space-used +++ b/salt/common/tools/sbin/so-elasticsearch-cluster-space-used @@ -6,11 +6,16 @@ # Elastic License 2.0. . /usr/sbin/so-common +{% from 'vars/globals.map.jinja' import GLOBALS %} 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' %} +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 +{% endif %} size=$(echo $i | grep -oE '[0-9].*' | awk '{print int($1+0.5)}') unit=$(echo $i | grep -oE '[A-Za-z]+') if [ $unit = "tb" ]; then