Skip to content

Instantly share code, notes, and snippets.

@textarcana
Forked from mrtazz/graphline.sh
Created July 29, 2012 13:33
Show Gist options
  • Save textarcana/3198836 to your computer and use it in GitHub Desktop.
Save textarcana/3198836 to your computer and use it in GitHub Desktop.

Revisions

  1. @mrtazz mrtazz created this gist Jul 20, 2012.
    10 changes: 10 additions & 0 deletions graphline.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #
    # shell function to print graphite graphs as sparklines in the terminal
    # needs https://github.com/holman/spark
    #
    function graphline() {
    GRAPHITEHOST="graphite.example.com"
    if [ ! -n "$1" ]; then print "Usage: $0 metric [minutes]"; return 1; fi
    if [ ! -n "$2" ]; then MINUTES=10 ; else MINUTES=$2; fi
    curl -s "${GRAPHITEHOST}/render?from=-${MINUTES}minutes&target=${1}&format=raw" | cut -d"|" -f 2 | spark ;
    }