Skip to content

Instantly share code, notes, and snippets.

@gjedeer
Created August 26, 2013 19:33
Show Gist options
  • Save gjedeer/6345625 to your computer and use it in GitHub Desktop.
Save gjedeer/6345625 to your computer and use it in GitHub Desktop.
Show Varnish cache utilization in percents and megabytes
v_bytes=`varnishstat -1 | grep s0.g_bytes | awk '{print $2}'`
v_space=`varnishstat -1 | grep s0.g_space | awk '{print $2}'`
v_total=$(( v_bytes + v_space ))
v_percent=$(( 100 * v_bytes / v_total ))
v_total_mb=$(( v_total/1024/1024 ))
v_bytes_mb=$(( v_bytes/1024/1024 ))
echo $v_percent % \($v_bytes_mb / $v_total_mb MB\)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment