Created
August 14, 2019 09:53
-
-
Save buggtb/8ac5984ee9e97898a23aa2eab5926139 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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