Skip to content

Instantly share code, notes, and snippets.

@buggtb
Created August 14, 2019 09:53
Show Gist options
  • Save buggtb/8ac5984ee9e97898a23aa2eab5926139 to your computer and use it in GitHub Desktop.
Save buggtb/8ac5984ee9e97898a23aa2eab5926139 to your computer and use it in GitHub Desktop.
#!/bin/bash
STATUS=$(ssacli ctrl slot=0 pd all show status)
#echo "${STATUS}"
readarray -t arr <<<"$STATUS"
echo $HOSTNAME
for i in "${!arr[@]}"; do
[ -n "${arr[$i]}" ] || unset "arr[$i]"
done
RESULTS=()
for element in "${arr[@]}"
do
echo "Line"
stringarray=($element)
RESULTS+=(${stringarray[0]}_${stringarray[1]}=${stringarray[-1]})
done
bar=$(printf ",%s" "${RESULTS[@]}")
bar=${bar:1}
echo "disk_health,host=${HOSTNAME} ${bar}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment