Counter

Documentation

Counter collects system metrics from your servers and streams them to a central dashboard. Install the CLI agent, and it continuously reports CPU, memory, disk, network, process, and container stats.

Quick Start

Install & configure (one command)

curl -fsSL https://counter.expt.sh/install.sh | bash

CLI Reference

counter login

Authenticate via browser-based device flow. Opens your browser to approve the CLI.

FlagDefaultDescription
--endpoint—Custom server endpoint URL

counter start

Start collecting and sending metrics. By default, daemonizes into the background.

FlagDefaultDescription
--interval60Collection interval in seconds
--hostname—Override the system hostname for metrics
--oncefalseCollect once and exit (no daemon)
--foregroundfalseRun in foreground instead of daemonizing
--installfalseInstall as systemd/launchd/schtasks service
--endpoint—Custom server endpoint URL
--token—API token (overrides config file)

counter stop

Stop a running background daemon.

Reads the PID file from ~/.config/counter/counter.pid and sends SIGTERM.

counter hostname

View or manage the persistent hostname override. Without a subcommand, prints the current effective hostname and its source.

SubcommandDescription
set <name>—Set a persistent hostname override
reset—Remove the override (use system hostname)

Hostname resolution order: --hostname flag → COUNTER_HOSTNAME env var → config file → system hostname.

counter query

Query stored metrics and print raw tabular output.

FlagDefaultDescription
<metric_type>—One of: system, disk, network, process, container
--host—Filter by hostname
--last1hTime range: 1h, 24h, 7d, etc.
--endpoint—Custom server endpoint URL
--token—API token (overrides config file)

counter graph

Query metrics and display sparkline/bar charts in your terminal.

FlagDefaultDescription
<metric_type>—One of: system, disk, network, process, container
--host—Filter by hostname
--last1hTime range: 1h, 24h, 7d, etc.
--endpoint—Custom server endpoint URL
--token—API token (overrides config file)

Environment Variables

VariablePurposeOverrides
COUNTER_BASE_URLServer endpoint URLConfig file endpoint
COUNTER_API_TOKENAPI auth tokenConfig file token
COUNTER_HOSTNAMEHostname for metricsConfig file hostname

Config files are stored at ~/.config/counter/ (token, endpoint, hostname).

Full Help Output

Show counter --help
Counter CLI

Usage: counter-linux-amd64 <COMMAND>

Commands:
  login     Authenticate via browser device flow
  start     Start collecting metrics
  stop      Stop a running daemon
  hostname  View or set the persistent hostname override
  query     Query metrics (raw table output)
  doctor    Diagnose configuration, Docker, and connectivity issues
  graph     Show metrics as TUI charts
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Collected Metrics

Each collection interval gathers five metric categories:

system

FieldDescription
cpu_percentOverall CPU usage (%)
load_1m / 5m / 15mSystem load averages
memory_total / used / percentRAM usage
swap_total / used / percentSwap usage

disk

FieldDescription
mountpointFilesystem mount path
device / fstypeDevice name and filesystem type
total / used / free / percentDisk space usage

network

FieldDescription
interfaceNetwork interface name
bytes_sent / bytes_recvTotal bytes transmitted/received
packets_sent / packets_recvTotal packets transmitted/received
errin / erroutReceive/transmit errors

process

FieldDescription
pid / nameProcess ID and command line
cpu_percent / memory_percentPer-process CPU and memory usage
read_bytes / write_bytesDisk I/O

Top 25 processes by CPU are reported each interval.

container

FieldDescription
container_id / container_nameDocker container identity
cpu_percent / memory_percentContainer resource usage
memory_usage / memory_limitMemory in bytes
net_rx_bytes / net_tx_bytesNetwork I/O
block_read_bytes / block_write_bytesBlock I/O
pidsNumber of processes in the container

Requires Docker to be installed and accessible.

Examples

Collect once (test run)

counter start --once

Run in foreground

counter start --foreground --interval 30

Install as system service

counter start --install

Creates a systemd service (Linux), launchd agent (macOS), or scheduled task (Windows) that auto-starts on boot.

Custom hostname

# Set a persistent hostname
counter hostname set prod-web-01

# Check current hostname
counter hostname

# Reset to system hostname
counter hostname reset

Query metrics

# System metrics from the last hour
counter query system

# Disk usage for a specific host over the last 7 days
counter query disk --host prod-web-01 --last 7d

# Container stats from the last 24 hours
counter query container --last 24h

Terminal charts

# CPU/memory sparklines
counter graph system

# Disk usage bar chart
counter graph disk --host prod-web-01

Windows install

irm https://counter.expt.sh/install.ps1 | iex

HTTP API for agents

Query your metrics with your account token. API reference and examples · Plain-text docs