Skip to content

Instantly share code, notes, and snippets.

@michaelbarton
Created October 15, 2015 22:53
Show Gist options
  • Save michaelbarton/a44809fed31dcdf88010 to your computer and use it in GitHub Desktop.
Save michaelbarton/a44809fed31dcdf88010 to your computer and use it in GitHub Desktop.
Needs bitly/data_hacks
pip install --user data_hacks
#!/bin/bash
set -o pipefail
qhost \
| egrep -v "^x|^uv|^mc1" \
| tr -s ' ' \
| cut -f 7 -d ' ' \
| sed 's/0.00/free/' \
| sed 's/[0-9].[0-9][0-9]/utilised/' \
| egrep -v "\-|NLOAD" \
| bar_chart.py --percentage
@accopeland
Copy link

Same result with less typing and fewer subprocesses:

qhost | awk 'NR>2 && !/^x|^uv|^mc1/ {if($7==0.00){print "free"} else {print "utilized"}}' | bar_chart.py --percentage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment