Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aantn/smag
Show Me A Graph - Command Line Graphing
https://github.com/aantn/smag
chart cli command-line console cpu graph kubernetes pipeline plot realtime stdout
Last synced: about 1 month ago
JSON representation
Show Me A Graph - Command Line Graphing
- Host: GitHub
- URL: https://github.com/aantn/smag
- Owner: aantn
- License: mit
- Created: 2020-11-21T09:51:28.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T15:51:52.000Z (8 months ago)
- Last Synced: 2024-12-12T06:49:40.910Z (about 2 months ago)
- Topics: chart, cli, command-line, console, cpu, graph, kubernetes, pipeline, plot, realtime, stdout
- Language: Rust
- Homepage:
- Size: 5.74 MB
- Stars: 139
- Watchers: 5
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-opensource-israel - 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. ![GitHub last commit](https://img.shields.io/github/last-commit/aantn/smag?style=flat-square) ![GitHub top language](https://img.shields.io/github/languages/top/aantn/smag?style=flat-square) (Projects by main language / rust)
README
# 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
![](./images/readme-example.gif)
Table of Contents
=================* [Install :cd:](#install-cd)
* [Usage ](#usage)# Install :cd:
## Install from source
```bash
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
```bash
$ 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] ...FLAGS:
-d, --diff Graph the diff of subsequent command outputs
--help Prints help information
-V, --version Prints version informationOPTIONS:
-h, --history Specify number of points to 'remember' and graph at once for each commands
[default: 100]
-n, --interval Specify update interval in seconds. [default: 1.0]
-y, --y-label Label/units for y-axis (e.g. 'MB', 'Seconds') [default: ]ARGS:
... Command(s) to run
```## Inspiration
**smag was inspired and based on code from the wonderful [gping](https://github.com/orf/gping) tool by Tom Forbes**# Other tools
I also work on [Robusta](https://github.com/robusta-dev/robusta) - better Prometheus based alerts for Kubernetes.