[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4906":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":16,"starSnapshotCount":16,"syncStatus":19,"lastSyncTime":39,"discoverSource":40},4906,"sampler","sqshq\u002Fsampler","sqshq","Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.","https:\u002F\u002Fsampler.dev",null,"Go",14575,662,167,57,0,4,16,2,72.06,"GNU General Public License v3.0",false,"master",[25,26,27,28,29,30,31,32,5,33,34,35],"alerting","charts","cmd","command-line","command-line-tool","dashbord","golang","monitoring","shell","terminal","visualization","2026-06-12 04:00:23","# Sampler. Visualization for any shell command.\n[![Build Status](https:\u002F\u002Ftravis-ci.com\u002Fsqshq\u002Fsampler.svg?token=LdyRhxxjDFnAz1bJg8fq&branch=master)](https:\u002F\u002Ftravis-ci.com\u002Fsqshq\u002Fsampler) [![Go Report Card](https:\u002F\u002Fgoreportcard.com\u002Fbadge\u002Fgithub.com\u002Fsqshq\u002Fsampler)](https:\u002F\u002Fgoreportcard.com\u002Freport\u002Fgithub.com\u002Fsqshq\u002Fsampler)\n\nSampler is a tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.\n\n![sampler](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F56404396-70b14d00-6234-11e9-93cd-54461bf40c96.gif)\n\n## Why do I need it?\nOne can sample any dynamic process right from the terminal — observe changes in the database, monitor MQ in-flight messages,  trigger a deployment script and get notification when it's done. \n\nIf there is a way to get a metric using a shell command, then it can be visualized with Sampler momentarily.\n\n## Installation\n\n### macOS\n\n[HomeBrew](https:\u002F\u002Fbrew.sh):\n```bash\nbrew install sampler\n```\n\n[MacPorts](https:\u002F\u002Fwww.macports.org):\n```bash\nsudo port install sampler\n```\n\nor\n```bash\nsudo curl -Lo \u002Fusr\u002Flocal\u002Fbin\u002Fsampler https:\u002F\u002Fgithub.com\u002Fsqshq\u002Fsampler\u002Freleases\u002Fdownload\u002Fv1.1.0\u002Fsampler-1.1.0-darwin-amd64\nsudo chmod +x \u002Fusr\u002Flocal\u002Fbin\u002Fsampler\n```\n\n### Linux\n```bash\nsudo wget https:\u002F\u002Fgithub.com\u002Fsqshq\u002Fsampler\u002Freleases\u002Fdownload\u002Fv1.1.0\u002Fsampler-1.1.0-linux-amd64 -O \u002Fusr\u002Flocal\u002Fbin\u002Fsampler\nsudo chmod +x \u002Fusr\u002Flocal\u002Fbin\u002Fsampler\n```\nNote: `libasound2-dev` system library is required to be installed for Sampler to play a [trigger](https:\u002F\u002Fgithub.com\u002Fsqshq\u002Fsampler#triggers) sound tone. Usually the library is in place, but if not - you can install it with your favorite package manager, e.g `apt install libasound2-dev`\n#### Packaging status\n- [Fedora](https:\u002F\u002Fapps.fedoraproject.org\u002Fpackages\u002Fgolang-github-sqshq-sampler) `sudo dnf install golang-github-sqshq-sampler` (F31+)\n- [Arch](https:\u002F\u002Faur.archlinux.org\u002Fpackages\u002Fsampler) `yay -S sampler`\n### Windows (experimental)\nRecommended to use with advanced console emulators, e.g. [Cmder](https:\u002F\u002Fcmder.app\u002F)\n\nVia [Chocolatey](https:\u002F\u002Fchocolatey.org\u002Fdocs)\n```powershell\nchoco install sampler\n```\nor\n\n[Download .exe](https:\u002F\u002Fgithub.com\u002Fsqshq\u002Fsampler\u002Freleases\u002Fdownload\u002Fv1.1.0\u002Fsampler-1.1.0-windows-amd64.exe)\n\n### Docker\n\n```\n# Create a configuration file\nvim config.yml\n\n# Build the container image\ndocker build --tag sampler .\n\n# Run a container\ndocker run --interactive --tty --volume $(pwd)\u002Fconfig.yml:\u002Froot\u002Fconfig.yml sampler --config \u002Froot\u002Fconfig.yml\n```\n\n## Usage\nYou specify shell commands, Sampler executes them with a required rate. The output is used for visualization.\n\nUsing Sampler is basically a 3-step process:\n- Define your shell commands in a YAML configuration file\n- Run `sampler -c config.yml`\n- Adjust components size and location on UI\n\n## But there are so many monitoring systems already\nSampler is by no means an alternative to full-scale monitoring systems, but rather an easy to setup development tool.\n\nIf spinning up and configuring [Prometheus with Grafana](https:\u002F\u002Fprometheus.io) is complete overkill for you task, Sampler might be the right solution. No servers, no databases, no deploy - you specify shell commands, and it just works.\n\n## Then it should be installed on every server I monitor?\nNo, you can run Sampler on local, but still gather telemetry from multiple remote machines. Any visualization might have `init` command, where you can ssh to a remote server. See the [SSH example](https:\u002F\u002Fgithub.com\u002Fsqshq\u002Fsampler#ssh)\n\n## Contents\n\n- [Components](#components)\n  - [Runchart](#runchart)\n  - [Sparkline](#sparkline)\n  - [Barchart](#barchart)\n  - [Gauge](#gauge)\n  - [Textbox](#textbox)\n  - [Asciibox](#asciibox)\n- [Bells and whistles](#bells-and-whistles)\n  - [Triggers (conditional actions)](#triggers)\n  - [Interactive shell (database interaction, remote server access, etc)](#interactive-shell-support)\n  - [Variables](#variables)\n  - [Color theme](#color-theme)\n- [Real-world recipes (contributions welcome!)](#real-world-recipes)\n  - [Databases (MySQL, PostgreSQL, MongoDB, Neo4j)](#databases)\n  - [Kafka](#kafka)\n  - [Docker](#docker)\n  - [SSH](#ssh)\n  - [JMX](#jmx)\n\n## Components\nThe following is a list of configuration examples for each component type, with macOS compatible sampling scripts. \n\n### Runchart\n![runchart](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F59168666-aff96d00-8b04-11e9-99b6-34d8bae37bd2.png)\n```yml\nruncharts:\n  - title: Search engine response time\n    rate-ms: 500        # sampling rate, default = 1000\n    scale: 2            # number of digits after sample decimal point, default = 1\n    legend:\n      enabled: true     # enables item labels, default = true\n      details: false    # enables item statistics: cur\u002Fmin\u002Fmax\u002Fdlt values, default = true\n    items:\n      - label: GOOGLE\n        sample: curl -o \u002Fdev\u002Fnull -s -w '%{time_total}'  https:\u002F\u002Fwww.google.com\n        color: 178      # 8-bit color number, default one is chosen from a pre-defined palette\n      - label: YAHOO\n        sample: curl -o \u002Fdev\u002Fnull -s -w '%{time_total}'  https:\u002F\u002Fsearch.yahoo.com\n      - label: BING\n        sample: curl -o \u002Fdev\u002Fnull -s -w '%{time_total}'  https:\u002F\u002Fwww.bing.com\n```\n### Sparkline\n![sparkline](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F59167746-de754900-8b00-11e9-9305-c9a4176634d2.png)\n```yml\nsparklines:\n  - title: CPU usage\n    rate-ms: 200\n    scale: 0\n    sample: ps -A -o %cpu | awk '{s+=$1} END {print s}'\n  - title: Free memory pages\n    rate-ms: 200\n    scale: 0\n    sample: memory_pressure | grep 'Pages free' | awk '{print $3}'\n```\n### Barchart\n![barchart](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F59167751-de754900-8b00-11e9-8d01-efd04ae1eec6.png)\n```yml\nbarcharts:\n  - title: Local network activity\n    rate-ms: 500        # sampling rate, default = 1000\n    scale: 0            # number of digits after sample decimal point, default = 1\n    items:\n      - label: UDP bytes in\n        sample: nettop -J bytes_in -l 1 -m udp | awk '{sum += $4} END {print sum}'\n      - label: UDP bytes out\n        sample: nettop -J bytes_out -l 1 -m udp | awk '{sum += $4} END {print sum}'\n      - label: TCP bytes in\n        sample: nettop -J bytes_in -l 1 -m tcp | awk '{sum += $4} END {print sum}'\n      - label: TCP bytes out\n        sample: nettop -J bytes_out -l 1 -m tcp | awk '{sum += $4} END {print sum}'\n```\n### Gauge\n![gauge](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F59318799-4c06ae00-8c96-11e9-868a-7fef803f3739.png)\n```yml\ngauges:\n  - title: Minute progress\n    rate-ms: 500        # sampling rate, default = 1000\n    scale: 2            # number of digits after sample decimal point, default = 1\n    percent-only: false # toggle display of the current value, default = false\n    color: 178          # 8-bit color number, default one is chosen from a pre-defined palette\n    cur:\n      sample: date +%S  # sample script for current value\n    max:\n      sample: echo 60   # sample script for max value\n    min:\n      sample: echo 0    # sample script for min value\n  - title: Year progress\n    cur:\n      sample: date +%j\n    max:\n      sample: echo 365\n    min:\n      sample: echo 0\n```\n### Textbox\n![textbox](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F59168949-192db000-8b06-11e9-900b-0e92ff494f62.png)\n```yml\ntextboxes:\n  - title: Local weather\n    rate-ms: 10000      # sampling rate, default = 1000\n    sample: curl wttr.in?0ATQF\n    border: false       # border around the item, default = true\n    color: 178          # 8-bit color number, default is white\n  - title: Docker containers stats\n    rate-ms: 500\n    sample: docker stats --no-stream --format \"table {{.Name}}\\t{{.CPUPerc}}\\t{{.MemUsage}}\\t{{.PIDs}}\"\n```\n### Asciibox\n![asciibox](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F59169283-aa515680-8b07-11e9-8beb-716a387aed1b.png)\n```yml\nasciiboxes:\n  - title: UTC time\n    rate-ms: 500        # sampling rate, default = 1000\n    font: 3d            # font type, default = 2d\n    border: false       # border around the item, default = true    \n    color: 43           # 8-bit color number, default is white\n    sample: env TZ=UTC date +%r\n```\n\n## Bells and whistles\n\n### Triggers\nTriggers allow to perform conditional actions, like visual\u002Fsound alerts or an arbitrary shell command.\nThe following examples illustrate the concept.\n\n#### Clock gauge, which shows minute progress and announces current time at the beginning of each minute\n\n```yml\ngauges:\n  - title: MINUTE PROGRESS\n    position: [[0, 18], [80, 0]]  \n    cur:\n      sample: date +%S\n    max:\n      sample: echo 60\n    min:\n      sample: echo 0\n    triggers:\n      - title: CLOCK BELL EVERY MINUTE\n        condition: '[ $label == \"cur\" ] && [ $cur -eq 0 ] && echo 1 || echo 0'  # expects \"1\" as TRUE indicator\n        actions:\n          terminal-bell: true  # standard terminal bell, default = false\n          sound: true    # NASA quindar tone, default = false\n          visual: false  # notification with current value on top of the component area, default = false\n          script: say -v samantha `date +%I:%M%p`  # an arbitrary script, which can use $cur, $prev and $label variables\n```\n\n#### Search engine latency chart, which alerts user when latency exceeds a threshold\n\n```yml\nruncharts:\n  - title: SEARCH ENGINE RESPONSE TIME (sec)\n    rate-ms: 200\n    items:\n      - label: GOOGLE\n        sample: curl -o \u002Fdev\u002Fnull -s -w '%{time_total}'  https:\u002F\u002Fwww.google.com\n      - label: YAHOO\n        sample: curl -o \u002Fdev\u002Fnull -s -w '%{time_total}'  https:\u002F\u002Fsearch.yahoo.com     \n    triggers:\n      - title: Latency threshold exceeded\n        condition: echo \"$prev \u003C 0.3 && $cur > 0.3\" |bc -l  # expects \"1\" as TRUE indicator\n        actions:\n          terminal-bell: true  # standard terminal bell, default = false\n          sound: true   # NASA quindar tone, default = false\n          visual: true  # visual notification on top of the component area, default = false\n          script: 'say alert: ${label} latency exceeded ${cur} second' # an arbitrary script, which can use $cur, $prev and $label variables\n```\n\n### Interactive shell support\nIn 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.\n\n#### Basic mode\n```yml\ntextboxes:\n  - title: MongoDB polling\n    rate-ms: 500\n    init: mongo --quiet --host=localhost test # executes only once to start the interactive session\n    sample: Date.now();                       # executes with a required rate, in scope of the interactive session\n    transform: echo result = $sample          # executes in scope of local session, $sample variable is available for transformation\n```\n\n#### PTY mode\nIn some cases interactive shell won't work, because its stdin is not a terminal. We can fool it, using PTY mode:\n```yml\ntextboxes:\n  - title: Neo4j polling\n    pty: true  # enables pseudo-terminal mode, default = false\n    init: cypher-shell -u neo4j -p pwd --format plain\n    sample: RETURN rand();\n    transform: echo \"$sample\" | tail -n 1\n  - title: Top on a remote server\n    pty: true  # enables pseudo-terminal mode, default = false\n    init: ssh -i ~\u002Fuser.pem ec2-user@1.2.3.4\n    sample: top    \n```\n\n#### Multistep init\nIt is also possible to execute multiple init commands one after another, before you start sampling.\n```yml\ntextboxes:\n  - title: Java application uptime\n    multistep-init:\n      - java -jar jmxterm-1.0.0-uber.jar\n      - open host:port # or local PID\n      - bean java.lang:type=Runtime\n    sample: get Uptime\n```    \n\n### Variables\nIf the configuration file contains repeated patterns, they can be extracted into the `variables` section.\nAlso variables can be specified using `-v`\u002F`--variable` flag on startup, and any system environment variables will also be available in the scripts.\n\n```yml\nvariables:\n    mongoconnection: mongo --quiet --host=localhost test\nbarcharts:\n  - title: MongoDB documents by status\n    items:\n      - label: IN_PROGRESS\n        init: $mongoconnection\n        sample: db.getCollection('events').find({status:'IN_PROGRESS'}).count()\n      - label: SUCCESS\n        init: $mongoconnection\n        sample: db.getCollection('events').find({status:'SUCCESS'}).count()\n      - label: FAIL\n        init: $mongoconnection\n        sample: db.getCollection('events').find({status:'FAIL'}).count()\n```\n\n### Color theme\n![light-theme](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6069066\u002F59959405-994c0200-9484-11e9-856b-c4d18716e1de.png)\n```yml\ntheme: light # default = dark\nsparklines:\n  - title: CPU usage\n    sample: ps -A -o %cpu | awk '{s+=$1} END {print s}'\n```\n\n## Real-world recipes\n### Databases\nThe following are different database connection examples. Interactive shell (init script) usage is recommended to establish connection only once and then reuse it during sampling.\n\n\u003Cdetails>\u003Csummary>MySQL\u003C\u002Fsummary>\n\n```yml\n# prerequisite: installed mysql shell\n\nvariables:\n  mysql_connection: mysql -u root -s --database mysql --skip-column-names\nsparklines:  \n  - title: MySQL (random number example)\n    pty: true\n    init: $mysql_connection\n    sample: select rand();\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>PostgreSQL\u003C\u002Fsummary>\n\n```yml\n# prerequisite: installed psql shell\n\nvariables:\n  PGPASSWORD: pwd\n  postgres_connection: psql -h localhost -U postgres --no-align --tuples-only\nsparklines:\n  - title: PostgreSQL (random number example)\n    init: $postgres_connection\n    sample: select random();\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>MongoDB\u003C\u002Fsummary>\n\n```yml\n# prerequisite: installed mongo shell\n\nvariables:\n  mongo_connection: mongo --quiet --host=localhost test\nsparklines:\n  - title: MongoDB (random number example)\n    init: $mongo_connection\n    sample: Math.random();\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Neo4j\u003C\u002Fsummary>\n\n```yml\n# prerequisite: installed cypher shell\n\nvariables:\n  neo4j_connection: cypher-shell -u neo4j -p pwd --format plain\nsparklines:\n  - title: Neo4j (random number example)\n    pty: true\n    init: $neo4j_connection\n    sample: RETURN rand();\n    transform: echo \"$sample\" | tail -n 1\n```\n\n\u003C\u002Fdetails>\n\n### Kafka\n\n\u003Cdetails>\u003Csummary>Kafka lag per consumer group\u003C\u002Fsummary>\n\n```yml\nvariables:\n  kafka_connection: $KAFKA_HOME\u002Fbin\u002Fkafka-consumer-groups --bootstrap-server localhost:9092\nruncharts:\n  - title: Kafka lag per consumer group\n    rate-ms: 5000\n    scale: 0\n    items:\n      - label: A->B\n        sample: $kafka_connection --group group_a --describe | awk 'NR>1 {sum += $5} END {print sum}'\n      - label: B->C\n        sample: $kafka_connection --group group_b --describe | awk 'NR>1 {sum += $5} END {print sum}'\n      - label: C->D\n        sample: $kafka_connection --group group_c --describe | awk 'NR>1 {sum += $5} END {print sum}'\n```\n\n\u003C\u002Fdetails>\n\n### Docker\n\n\u003Cdetails>\u003Csummary>Docker containers stats (CPU, MEM, O\u002FI)\u003C\u002Fsummary>\n\n```yml\ntextboxes:\n  - title: Docker containers stats\n    sample: docker stats --no-stream --format \"table {{.Name}}\\t{{.CPUPerc}}\\t{{.MemPerc}}\\t{{.MemUsage}}\\t{{.NetIO}}\\t{{.BlockIO}}\\t{{.PIDs}}\"\n```\n\n\u003C\u002Fdetails>\n\n### SSH\n\n\u003Cdetails>\u003Csummary>TOP command on a remote server\u003C\u002Fsummary>\n\n```yml\nvariables:\n  sshconnection: ssh -i ~\u002Fmy-key-pair.pem ec2-user@1.2.3.4\ntextboxes:\n  - title: SSH\n    pty: true\n    init: $sshconnection\n    sample: top\n```\n\n\u003C\u002Fdetails>\n\n### JMX\n\n\u003Cdetails>\u003Csummary>Java application uptime example\u003C\u002Fsummary>\n\n```yml\n# prerequisite: download [jmxterm jar file](https:\u002F\u002Fdocs.cyclopsgroup.org\u002Fjmxterm)\n\ntextboxes:\n  - title: Java application uptime\n    multistep-init:\n      - java -jar jmxterm-1.0.0-uber.jar\n      - open host:port # or local PID\n      - bean java.lang:type=Runtime\n    sample: get Uptime\n    transform: echo $sample | tr -dc '0-9' | awk '{printf \"%.1f min\", $1\u002F1000\u002F60}'\n```\n\n\u003C\u002Fdetails>\n","Sampler 是一个用于执行 shell 命令、可视化和告警的工具，通过简单的 YAML 文件进行配置。它使用 Go 语言编写，支持命令行输出的实时监控与图形化展示，并能够根据预设条件触发通知。适合需要快速搭建轻量级监控环境或在开发过程中对动态变化的数据（如数据库状态、消息队列中的消息数量等）进行即时观察的场景。相比复杂的监控系统，Sampler 提供了一种更加简便快捷的方式来实现基本的监控需求。","2026-06-11 03:01:25","top_language"]