Skip to content
forked from rs/jplot

iTerm2 expvar/JSON monitoring tool

License

Notifications You must be signed in to change notification settings

platinummonkey/jplot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jplot

license Build Status

Jplot tracks expvar-like (JSON) metrics and plot their evolution over time right into your iTerm2 terminal.

all

Above capture is jplot monitoring a Go service's expvar:

jplot --url http://:8080/debug/vars \
    memstats.HeapAlloc+memstats.HeapSys+memstats.HeapAlloc+memstats.HeapIdle+marker:counter:memstats.NumGC \
    counter:memstats.TotalAlloc \
    memstats.HeapObjects \
    memstats.StackSys+memstats.StackInuse

Install

go get -u github.com/rs/jplot

This tool does only work with iTerm2.

Usage

Given the following JSON output:

{
    "mem": {
        "Heap": 1234,
        "Sys": 4321,
        "Stack": 203
    },
    "cpu": {
        "STime": 123,
        "UTime":1234
    },
    "Threads": 2
}

You can graph the number of thread over time:

jplot --url http://:8080/debug/vars Threads

Or create a graph with both Utime and Stime growth rate on the same axis by using + between two field paths:

jplot --url http://:8080/debug/vars counter:cpu.STime+counter:cpu.UTime

Note: the counter: prefix instructs jplot to compute the difference between the values instead of showing their absolute value.

Or create several graphs by providing groups of fields as separate arguments; each argument creates a new graph:

jplot --url http://:8080/debug/vars mem.Heap+mem.Sys+mem.Stack counter:cpu.STime+cpu.UTime Threads

Spec Syntax

Each positional arguments given to jplot create a stacked graph with the specified values. To reference the values, use gojq JSON query syntax. Several value paths can be referenced for the same graph by using the + character to separate them.

In addition, each value path can be prefixed with options separated from the path by a column. Several options can be used for the same command by separating them with a comma like so: option1,option2:value.path.

Supported options are:

  • counter: Computes the difference with the last value. The value must increase monotonically.
  • marker: When the value is none-zero, a vertical line is drawn.

Memstats

Here is an example command to graph a Go program memstats:

jplot --url http://:8080/debug/vars \
    memstats.HeapAlloc+memstats.HeapSys+memstats.HeapAlloc+memstats.HeapIdle+marker:counter:memstats.NumGC \
    counter:memstats.TotalAlloc \
    memstats.HeapObjects \
    memstats.StackSys+memstats.StackInuse

About

iTerm2 expvar/JSON monitoring tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%