Skip to content

Instantly share code, notes, and snippets.

@scr512
Last active August 29, 2015 14:00
Show Gist options
  • Save scr512/11233605 to your computer and use it in GitHub Desktop.
Save scr512/11233605 to your computer and use it in GitHub Desktop.
send_to_dashing.sh (NAHPC)
#!/bin/zsh
#Stats->Dashing
#08/22/14 Added in some uh... logic to account for column number changes when a disk pool is in an 'ATTN' state
#07/23/14 Commented out the heat stuff as heat is expensive to run on a large cluster
hdd=$(isi_classic status -d | grep 'Used:' | awk '{print$3}' | tr -d '()%')
ssd=$(isi_classic status -d | grep 'Used:' | awk '{print$5}' | tr -d '()%')
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$hdd"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-hdd"
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$ssd"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-ssd"
tier2_pool1_query=$(isi status -d -q | grep T2Pool1)
tier2_pool1_status=$(echo $tier2_pool1_query | awk {'print $2,$3'} | sed 's/[0-9]*[M,G,B]*|* *//g')
if [ $tier2_pool1_status = OK ]
then
tier2_pool1=$(echo $tier2_pool1_query | awk '{print $10}' | tr -d '%)|')
else
tier2_pool1=$(echo $tier2_pool1_query | awk '{print $8}' | tr -d '%)|')
fi
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$tier2_pool1"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-tier2_pool1"
tier2_pool2_query=$(isi status -d -q | grep T2Pool2)
tier2_pool2_status=$(echo $tier2_pool2_query | awk {'print $2,$3'} | sed 's/[0-9]*[M,G,B]*|* *//g')
if [ $tier2_pool2_status = OK ]
then
tier2_pool2=$(echo $tier2_pool2_query | awk '{print $10}' | tr -d '%)|')
else
tier2_pool2=$(echo $tier2_pool2_query | awk '{print $8}' | tr -d '%)|')
fi
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$tier2_pool2"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-tier2_pool2"
tier2_pool3_query=$(isi status -d -q | grep T2Pool3)
tier2_pool3_status=$(echo $tier2_pool3_query | awk {'print $2,$3'} | sed 's/[0-9]*[M,G,B]*|* *//g')
if [ $tier2_pool3_status = OK ]
then
tier2_pool3=$(echo $tier2_pool3_query | awk '{print $10}' | tr -d '%)|')
else
tier2_pool3=$(echo $tier2_pool3_query | awk '{print $8}' | tr -d '%)|')
fi
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$tier2_pool3"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-tier2_pool3"
tier4_query=$(isi status -d -q | grep T4)
tier4_status=$(echo $tier4_query | awk {'print $2,$3'} | sed 's/[0-9]*[M,G,B]*|* *//g')
if [ $tier4_status = OK ]
then
tier4=$(echo $tier4_query | awk '{print $10}' | tr -d '%)|')
else
tier4=$(echo $tier4_query | awk '{print $8}' | tr -d '%)|')
fi
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "value": "'"$tier4"'" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-tier4"
clu_health=$(isi_classic statistics query -nall --stats=cluster.health | grep average | awk '{print$2}')
if [ $clu_health -eq 0 ]
then
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "text": "Healthy", "background-color":
"#12DE4F" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-health"
else
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "text": "Attention", "background-color":
"#F7D708" }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc-health"
fi
/usr/local/bin/wget -O- --post-data='{ "auth_token": "St0r!tCS", "title": "NAHPC Isilon cluster utilization", "progress_items": [{ "name": "'"nahpc-nas01 - HDD"'", "progress": "'"$hdd"'" }, { "name": "'"nahpc-nas01 - SSD"'", "progress": "'"$ssd"'" }, { "name": "'"nahpc-nas01 - Tier 2 Pool 1"'", "progress": "'"$tier2_pool1"'" }, { "name": "'"nahpc-nas01 - Tier 2 Pool 2"'", "progress": "'"$tier2_pool2"'" }, { "name": "'"nahpc-nas01 - Tier 2 Pool 3"'", "progress": "'"$tier2_pool3"'" }, { "name": "'"nahpc-nas01 - Tier 4"'", "progress": "'"$tier4"'" } ] }' --header=Content-Type:application/json "http://10.112.81.131:3030/widgets/nahpc_isi_classiclon-usage"
#heat=($(isi statistics heat --nodes=all --totalby=Path --pathdepth=5 | head -20 | grep ifs | awk '{print $5,$1}' | egrep -v ".ifsvar" | sed 's,/ifs/,/,g' | xargs))
#heat_array=($heat)
#/usr/local/bin/curl -d '{ "auth_token": "St0r!tCS", "items": [{ "label": "'"$heat_array[1]"'", "value": "'"$heat_array[2]"'" } , { "label": "'"$heat_array[3]"'", "value": "'"$heat_array[4]"'" } , { "label": "'"$heat_array[5]"'", "value": "'"$heat_array[6]"'" } , { "label": "'"$heat_array[7]"'", "value": "'"$heat_array[8]"'" } , { "label": "'"$heat_array[9]"'", "value": "'"$heat_array[10]"'" } , { "label": "'"$heat_array[11]"'", "value": "'"$heat_array[12]"'" } , { "label": "'"$heat_array[13]"'", "value": "'"$heat_array[14]"'" } , { "label": "'"$heat_array[15]"'", "value": "'"$heat_array[16]"'" } , { "label": "'"$heat_array[17]"'", "value": "'"$heat_array[18]"'" } , { "label": "'"$heat_array[19]"'", "value": "'"$heat_array[20]"'" } ] }' http://10.112.81.131:3030/widgets/nahpc-nas01-topdirs
clients=($(isi statistics client --nodes=all --orderby ops --totalby username --noheader | head -10 | awk '{print $8,$1}'| xargs))
clients_array=($clients)
/usr/local/bin/curl -d '{ "auth_token": "St0r!tCS", "items": [{ "label": "'"$clients_array[1]"'", "value": "'"$clients_array[2]"'" } , { "label": "'"$clients_array[3]"'", "value": "'"$clients_array[4]"'" } , { "label": "'"$clients_array[5]"'", "value": "'"$clients_array[6]"'" } , { "label": "'"$clients_array[7]"'", "value": "'"$clients_array[8]"'" } , { "label": "'"$clients_array[9]"'", "value": "'"$clients_array[10]"'" } , { "label": "'"$clients_array[11]"'", "value": "'"$clients_array[12]"'" } , { "label": "'"$clients_array[13]"'", "value": "'"$clients_array[14]"'" } , { "label": "'"$clients_array[15]"'", "value": "'"$clients_array[16]"'" } , { "label": "'"$clients_array[17]"'", "value": "'"$clients_array[18]"'" } , { "label": "'"$clients_array[19]"'", "value": "'"$clients_array[20]"'" } ] }' http://10.112.81.131:3030/widgets/nahpc-nas01-topclients
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment