Skip to content

Instantly share code, notes, and snippets.

@scr512
Created September 17, 2013 21:56
Show Gist options
  • Save scr512/6601232 to your computer and use it in GitHub Desktop.
Save scr512/6601232 to your computer and use it in GitHub Desktop.
Send Isilon disk usage and cluster status from node to Dashing dashboard via ghetto BASH JSON PUT.
#!/bin/zsh
hdd=$(isi status | grep 'Used:' | awk '{print$3}' | tr -d '()%')
clu_health=$(isi statistics query -nall --stats=cluster.health | grep average | awk '{print$2}')
/usr/local/bin/wget -O- --post-data='{ "auth_token": "mysecrettokenring", "value": "'"$hdd"'" }' --header=Content-Type:application/json "http://10.112.88.114:3030/widgets/aus-hdd"
if [ $clu_health -eq 0 ]
then
/usr/local/bin/wget -O- --post-data='{ "auth_token": "mysecrettokenring", "text": "Healthy", "background-color": "#12DE4F" }' --header=Content-Type:application/json "http://10.112.88.114:3030/widgets/aus-health"
else
/usr/local/bin/wget -O- --post-data='{ "auth_token": "mysecrettokenring", "text": "Attention", "background-color": "#DE4C12" }' --header=Content-Type:application/json "http://10.112.88.114:3030/widgets/aus-health"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment