Sampler is a command-line telemetry tool written in Go that visualizes real-time server and database metrics as sparklines directly in your terminal. It aims to provide lightweight, immediate feedback on system or application state by sampling remote or local data sources, making monitoring both accessible and minimally intrusive.
What sampler does and how it’s built
At its core, Sampler connects to various data sources — databases like MySQL, PostgreSQL, MongoDB, or arbitrary shell commands — samples metrics periodically, and renders them as small sparkline charts in the terminal.
The architecture is straightforward and pragmatic: Sampler acts as a client-side tool that runs locally but can collect telemetry from multiple remote machines over SSH. This design means you don’t have to install Sampler on every server you want to monitor; instead, you can execute commands remotely and stream the output.
The project is implemented in Go, which gives it a small footprint, fast startup, and easy cross-compilation for multiple OSes. It targets common platforms with explicit installation instructions for macOS (via Homebrew and MacPorts), Linux (including Fedora and Arch packaging), and Windows (experimental).
Sampler relies on external shell utilities and database clients (like mysql shell, psql, mongo shell) to execute sampling queries or commands. These commands are specified in YAML configuration files, allowing flexible setup for different environments and metrics.
Technical strengths and tradeoffs
One of the standout technical qualities of Sampler is its minimalistic but effective approach to terminal telemetry visualization. Instead of building a heavyweight monitoring stack or a web UI, it focuses on sparklines rendered in the terminal — small, low-overhead, and immediately visible to users who spend a lot of time in the shell.
The Go codebase is clean and idiomatic, leveraging Go’s concurrency model to handle multiple samples and remote connections efficiently. The design that Sampler does not require installation on every remote server but gathers data over SSH is a smart tradeoff balancing deployment simplicity and data collection capabilities.
However, this design also limits Sampler’s monitoring scope: it depends on the availability of command-line clients and shell access on the target machines. It’s not a full-fledged monitoring solution with agents or push-based telemetry.
Another tradeoff is its visualization medium. Terminal sparklines are great for quick, low-noise feedback but won’t replace rich dashboards or long-term data storage and analysis. This makes Sampler more suited for developers or sysadmins who want instant, at-a-glance insights without leaving the terminal.
The installation process is well-documented with exact commands for each platform, which reflects good attention to developer experience. The binary releases and package manager support make it easy to adopt.
Quick start
Sampler supports installation via package managers or direct binary download:
macOS
brew install sampler
or
sudo curl -Lo /usr/local/bin/sampler https://github.com/sqshq/sampler/releases/download/v1.1.0/sampler-1.1.0-darwin-amd64
sudo chmod +x /usr/local/bin/sampler
Linux
sudo wget https://github.com/sqshq/sampler/releases/download/v1.1.0/sampler-1.1.0-linux-amd64 -O /usr/local/bin/sampler
sudo chmod +x /usr/local/bin/sampler
Make sure to install the libasound2-dev system library for audio notification support if needed.
Windows (experimental)
Install via Chocolatey:
choco install sampler
Using sampler with databases
Sampler config files let you define variables and sampling queries. For example, to sample a random number from MySQL:
variables:
mysql_connection: mysql -u root -s --database mysql --skip-column-names
sparklines:
- title: MySQL (random number example)
pty: true
init: $mysql_connection
sample: select rand();
Or for PostgreSQL:
variables:
PGPASSWORD: pwd
postgres_connection: psql -h localhost -U postgres --no-align --tuples-only
sparklines:
- title: PostgreSQL (random number example)
init: $postgres_connection
sample: select random();
This flexibility means you can monitor any metric accessible via shell commands or database queries.
Verdict
Sampler fills a niche for developers and sysadmins who want lightweight, on-demand terminal telemetry without deploying complex monitoring stacks. Its Go implementation ensures cross-platform compatibility and low overhead, and the SSH-based remote sampling is a practical deployment choice.
That said, it’s not a replacement for comprehensive monitoring solutions. Its reliance on external shells and command-line clients limits its applicability to environments where you have direct shell access and appropriate clients installed.
If you prefer quick terminal feedback and want to integrate telemetry into your workflow without leaving the console, Sampler is worth exploring. Its simplicity and extensibility make it a handy tool for ad-hoc monitoring and quick diagnostics.
Related Articles
- Managing dotfiles and system configs with Nix flakes in Mic92/dotfiles — Mic92/dotfiles uses Nix flakes to manage NixOS system configurations, dotfiles, and a standalone Neovim setup, enabling
- witr: tracing the full causality chain of running processes in Go — witr is a Go CLI that traces the full causality chain of any running process, replacing fragmented commands with a singl
- Inside fzf: how a Go fuzzy finder processes millions of items instantly — fzf is a fast, portable command-line fuzzy finder in Go that processes millions of items instantly. This article explore
- Ollama: a unified CLI and API platform for local large language models — Ollama simplifies running and managing open-source large language models locally with a unified CLI and REST API, suppor
→ GitHub Repo: sqshq/sampler ⭐ 14,559 · Go