Sampler - Visualization for any shell command.

Sampler is an simple, effective and powerful tool for charting directly in the terminal.

To install on macOS:

brew install sampler

Output from any command can be charted through a simple terminal command specified in the config file.

A simple example is as follows:

cat sampler.yaml 

theme: light # default = dark
sparklines:
  - title: CPU usage
    sample: ps -A -o %cpu | awk '{s+=$1} END {print s}'

Run sampler as follows:

sampler -c sampler.yaml

Sample steamed data

Lets say you want to chart data that is streamed from e.g. a terminal serial port.

One way to handle this is to create one small script that add data to a file.

while sleep 1; do ps -A -o %cpu | awk '{s+=$1} END {print s}' >> data.out ; done

And then let sampler read that value.

cat sampler.yaml 

theme: light # default = dark
sparklines:
  - title: CPU usage
    sample: cat data.out