Go to file
Alexander Lukyanchikov 43d4ab758b
add dowload links
2019-06-18 00:49:53 -04:00
asset minor error formatting improvements 2019-05-20 00:14:13 -04:00
client added periodic actions (licence verification, statistics report, start with nag window) 2019-06-09 00:16:56 -04:00
component enhance delta value formatting 2019-06-12 23:35:12 -04:00
config basic config validation added 2019-06-09 15:00:16 -04:00
console pause function visualization and handling enhancements 2019-06-07 01:09:37 -04:00
data close interactive shell cmd on session restart 2019-06-09 10:37:05 -04:00
event stop all samplers on pause 2019-06-07 01:39:11 -04:00
metadata added telemetry reports and license registration 2019-05-27 21:44:06 -04:00
.gitignore added gitignore 2019-01-24 23:11:26 -05:00
.travis.yml Update .travis.yml 2019-05-20 22:18:57 -04:00
LICENSE LICENSE added 2019-04-19 23:38:25 -04:00
README.md add dowload links 2019-06-18 00:49:53 -04:00
example.yml basic config validation added 2019-06-09 15:00:16 -04:00
go.mod multiple cosmetic improvements 2019-06-02 20:53:15 -04:00
go.sum multiple cosmetic improvements 2019-06-02 20:53:15 -04:00
main.go added periodic actions (licence verification, statistics report, start with nag window) 2019-06-09 00:16:56 -04:00

README.md

Sampler. Visualization for any shell command.

Build Status Go Report Card

Sampler is a tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

sampler

Installation

macOS

sudo curl -Lo /usr/local/bin/sampler https://github.com/sqshq/sampler/releases/download/v0.9.1-beta/sampler-0.9.1-darwin-amd64
sudo chmod +x /usr/local/bin/sampler

Linux

sudo curl -Lo /usr/local/bin/sampler https://github.com/sqshq/sampler/releases/download/v0.9.1-beta/sampler-0.9.1-linux-amd64
sudo chmod +x /usr/local/bin/sampler

Windows

download .exe

Usage

You specify shell commands, Sampler executes them with a required rate. The output is used for visualization.

One can sample any dynamic process right from the terminal - observe changes in the database, monitor MQ in-flight messages, trigger deployment process and get notification when it's done.

Using Sampler is basically a 3-step process:

  • Define your configuration in a YAML file
  • Run sampler -c config.yml
  • Adjust components size and location on UI

Contents

Components

The following is a list of configuration examples for each component type, with macOS compatible sample scripts.

Runchart

runchart

runcharts:
  - title: Search engine response time
    rate-ms: 500        # sampling rate, default = 1000
    scale: 2            # number of digits after sample decimal point, default = 1
    legend:
      enabled: true     # enables item labels, default = true
      details: false    # enables item statistics: cur/min/max/dlt values, default = true
    items:
      - label: GOOGLE
        sample: curl -o /dev/null -s -w '%{time_total}'  https://www.google.com
        color: 178      # 8-bit color number, default one is chosen from a pre-defined palette
      - label: YAHOO
        sample: curl -o /dev/null -s -w '%{time_total}'  https://search.yahoo.com
      - label: BING
        sample: curl -o /dev/null -s -w '%{time_total}'  https://www.bing.com

Sparkline

sparkline

sparklines:
  - title: CPU usage
    rate-ms: 200
    scale: 0
    sample: ps -A -o %cpu | awk '{s+=$1} END {print s}'
  - title: Free memory pages
    rate-ms: 200
    scale: 0
    sample: memory_pressure | grep 'Pages free' | awk '{print $3}'

Barchart

barchart

barcharts:
  - title: Local network activity
    rate-ms: 500        # sampling rate, default = 1000
    scale: 0            # number of digits after sample decimal point, default = 1
    items:
      - label: UDP bytes in
        sample: nettop -J bytes_in -l 1 -m udp | awk '{sum += $4} END {print sum}'
      - label: UDP bytes out
        sample: nettop -J bytes_out -l 1 -m udp | awk '{sum += $4} END {print sum}'
      - label: TCP bytes in
        sample: nettop -J bytes_in -l 1 -m tcp | awk '{sum += $4} END {print sum}'
      - label: TCP bytes out
        sample: nettop -J bytes_out -l 1 -m tcp | awk '{sum += $4} END {print sum}'

Gauge

gauge

gauges:
  - title: Minute progress
    rate-ms: 500        # sampling rate, default = 1000
    scale: 2            # number of digits after sample decimal point, default = 1
    color: 178          # 8-bit color number, default one is chosen from a pre-defined palette
    cur:
      sample: date +%S  # sample script for current value
    max:
      sample: echo 60   # sample script for max value
    min:
      sample: echo 0    # sample script for min value
  - title: Year progress
    cur:
      sample: date +%j
    max:
      sample: echo 365
    min:
      sample: echo 0

Textbox

textbox

textboxes:
  - title: Local weather
    rate-ms: 10000      # sampling rate, default = 1000
    sample: curl wttr.in?0ATQF
    border: false       # border around the item, default = true
    color: 178          # 8-bit color number, default is white
  - title: Docker containers stats
    rate-ms: 500
    sample: docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.PIDs}}"

Asciibox

asciibox

asciiboxes:
  - title: UTC time
    rate-ms: 500        # sampling rate, default = 1000
    font: 3d            # font type, default = 2d
    border: false       # border around the item, default = true    
    color: 43           # 8-bit color number, default is white
    sample: env TZ=UTC date +%r

Bells and whistles

Triggers

Triggers allow to perform conditional actions, like visual/sound alerts or an arbitrary shell command.

Interactive shell support

In addition to the sample command, one can specify init command (executed only once before sampling) and transform command (to post-process sample command output). That covers interactive shell use case, e.g. to establish connection to a database only once, and then perform polling within interactive shell session. MongoDB example: ...

Variables

If the configuration file contains repeated patterns, they can be extracted into the variables section. Also variables can be specified using -v/--variable flag on startup, and any system environment variables will also be available in the scripts.

Color theme

...

Real-world examples

...