Last active
September 21, 2015 15:19
-
-
Save pgtwitter/708ffea6010ee98f0d50 to your computer and use it in GitHub Desktop.
Used Volume Size Ratio of NASNE (on Mac OS X / マウント済みのケース)
This file contains hidden or 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 | |
NAME=`smbutil statshares -a | awk 'BEGIN{F=0}/^nasne_home/{F=1}F==1 && /SERVER_NAME/ {print $2;exit}'` | |
IPADDR=`smbutil lookup ${NAME} | awk '/^IP address of /{print $NF}'` | |
URL="http://${IPADDR}:64210/status/HDDInfoGet?id=0" | |
curl -s ${URL} \ | |
| awk '{gsub("[,}]", "\n");print $0}' \ | |
| awk '/usedVolumeSize/{u=$NF}/totalVolumeSize/{t=$NF}END{printf "%.2f%%\n", u/t*100}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NAMEがわかってたら2行目は直接代入すれば,マウントしてなくても使用できる(?)(NAME="nasne-000000").
nasne HOME: ver 2.51
参考: "【nasne】APIを調べてみた。ディスク容量が知りたい、他" http://pocketstudio.jp/log3/2014/12/07/nasune_api/