Coder Social home page Coder Social logo

smag's Introduction

smag - show me a graph!

Easily create graphs from cli commands and view them in the terminal. Like the watch command but with a graph of the output.

Demo

Table of Contents

Install ๐Ÿ’ฟ

Install from source

git clone https://github.com/aantn/smag.git
cargo install --path .

Install from binaries

Binaries for Mac, Windows, and Linux are available under Releases.

Usage

Just run smag [shell_cmd] or smag [cmd1] [cmd2] if you want to graph multiple commands at once. You can control how often the graph updates with the -n flag. You can also graph a derivative of the command's output using -d.

smag can graph any command which outputs an integer or float. Any whitespace before/after the number is trimmed automatically.

Pull requests for more features or fixes are welcome.

Examples

  • Graph number of processes: smag "ps aux | wc -l"
  • Graph number of bash processes and ssh processes as two separate lines: smag "ps aux | grep ssh | wc -l" "ps aux | grep bash | wc -l"
  • Graph number of running Kubernetes pods: smag "kubectl get pods -A | grep Running | wc -l"
  • Graph CPU temperature on Raspberry Pi 5: sudo -v && smag -n 0.5 -y ยฐC "sudo vcgencmd measure_temp | tr -d -c 0-9."

Full Usage

$ smag --help
smag 0.6.0
Show Me A Graph - Like the `watch` command but with a graph of previous values.

USAGE:
    smag [FLAGS] [OPTIONS] <cmds>...

FLAGS:
    -d, --diff       Graph the diff of subsequent command outputs
        --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -h, --history <buffer-size>          Specify number of points to 'remember' and graph at once for each commands
                                         [default: 100]
    -n, --interval <polling-interval>    Specify update interval in seconds. [default: 1.0]
    -y, --y-label <y-label>              Label/units for y-axis (e.g. 'MB', 'Seconds') [default: ]

ARGS:
    <cmds>...    Command(s) to run

Inspiration

smag was inspired and based on code from the wonderful gping tool by Tom Forbes

Other tools

I also work on Robusta - better Prometheus based alerts for Kubernetes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.