Visual Server Monitoring Made Easy with Sampler: Install & Configure
This article introduces the Sampler visual monitoring tool, explains how to install it on Linux, and provides step‑by‑step YAML configuration examples for tracking CPU, memory, Docker containers, network activity, and system time, enabling quick, intuitive server status checks.
Sampler Introduction
Sampler is a shell‑based visual monitoring tool that uses simple YAML files for configuration and can display server metrics such as CPU, memory, network, and container status. It has gained over 12k stars on GitHub.
Installation
Download the Sampler binary and place it in
/usr/local/bin:
<code># Download sampler package to /usr/local/bin
sudo wget https://github.com/sqshq/sampler/releases/download/v1.1.0/sampler-1.1.0-linux-amd64 -O /usr/local/bin/sampler
# Make the binary executable
sudo chmod +x /usr/local/bin/sampler</code>After installation, the executable
sampleris available in
/usr/local/bin.
Usage
Configure monitoring scripts in a
yamlfile and run Sampler with the configuration:
<code># Make the config file executable
chmod +x config.yml
# Start Sampler with the config
sampler -c config.yml</code>Examples of YAML snippets:
<code>sparklines:
- title: CPU usage(%)
rate-ms: 200
scale: 0
sample: ps -A -o %cpu | awk '{s+=$1} END {print s}'
- title: RAM free(MB)
rate-ms: 200
scale: 0
sample: free -m | grep "Mem:" | awk '{print $4}'
textboxes:
- title: Docker containers stats
rate-ms: 500
sample: docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.PIDs}}"
barcharts:
- title: Local network activity
rate-ms: 500
items:
- label: UDP bytes in
sample: netstat -anu | awk '{sum += $2} END {print sum}'
- label: UDP bytes out
sample: netstat -anu | awk '{sum += $3} END {print sum}'
- label: TCP bytes in
sample: netstat -ant | awk '{sum += $2} END {print sum}'
- label: TCP bytes out
sample: netstat -ant | awk '{sum += $3} END {print sum}'
asciiboxes:
- title: CST time
rate-ms: 500
font: 2d
border: false
color: 43
sample: env TZ=Asia/Shanghai date +%r</code>Running Sampler with these configurations displays real‑time charts, sparklines, and text boxes for the selected metrics.
Summary
Sampler provides an intuitive, visual way to monitor server health and can also be extended to monitor middleware such as MySQL, MongoDB, and Kafka.
Project Address
GitHub repository: https://github.com/sqshq/sampler
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.