From ae6fbab45d421c4aaf705e694611016b4d602f60 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Mon, 19 Sep 2022 10:27:20 -0400 Subject: [PATCH] refactor sostatus telegraf input script --- salt/telegraf/scripts/sostatus.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/salt/telegraf/scripts/sostatus.sh b/salt/telegraf/scripts/sostatus.sh index d1753eadb..c30220fff 100644 --- a/salt/telegraf/scripts/sostatus.sh +++ b/salt/telegraf/scripts/sostatus.sh @@ -11,12 +11,11 @@ if [[ ! "`pidof -x $(basename $0) -o %PPID`" ]]; then SOSTATUSLOG=/var/log/sostatus/status.log - SOSTATUSCODE=$(jq -r .status_code /var/log/sostatus/status.log) - SOSTATUSJSON=$(cat /var/log/sostatus/status.log) + SOSTATUSCODE=$(jq -r .status_code $SOSTATUSLOG) + SOSTATUSJSON=$(cat $SOSTATUSLOG | sed 's/"/\\"/g') if [ -f "$SOSTATUSLOG" ]; then - echo "sostatus status=$SOSTATUSCODE" - echo "sostatus json=$SOSTATUSJSON" + echo "sostatus status=$SOSTATUSCODE,json=\"$SOSTATUSJSON\"" else exit 0 fi