pipeplot - interactive visualization of the data stream from pipe in the console

For those who do not want to leave the console, they love its ascii-graphics, a utility for drawing graphs from pipe has appeared. Under cat animation and examples.

Ping




ping ya.ru | grep --line-buffered time | sed -u -e 's#.*time=\([^ ]*\).*#\1#' | pipeplot --min 0

Can track coronavirus via covidAPI


while true; \
    do curl -s https://coronavirus-19-api.herokuapp.com/all \
    | jq '.deaths'; \
    sleep 60; \
done \
| pipeplot --color 1 --direction left

need to install jq to parse json

Five hundred through graphite


while true; \
do \
    curl -s 'http://graphite/render?target=my_app_rps_error&format=json&from=-5min&until=now' \
    | jq -c '.[0].datapoints[-1]'; \
    sleep 5; \
done \
| sed -u s/null/0/ \
| stdbuf -oL uniq \
| stdbuf -oL jq '.[0]' \
| pipeplot

Buffering


Many console utilities buffer stdout. Because of this, the serial pipe breaks. Some utilities support buffering: sed -u , grep --line-buffered . Otherwise, you can use the universal method stdbuf -oL and unbuffer .

Available options


the COLOR --color - the color of the columns, the number of palettes use Xterm
--symbol the SYMBOL - symbol to display columns support the seals
--scale all {,} window - setting automatic scaling minimum and maximum, all - takes into account all data, window - only the visible
--direction {left, right} - direction
--min MIN --max MAX - fixes the minimum and maximum, combined with automatic scaling

Installation


pip install pipeplot

PS: Welcome to the github project ^ - ^. Write in PRs, or comments, your examples. I will add the most interesting to readme!

All Articles