- Add VERSION file as canonical version source - build.sh reads VERSION file automatically, injects via -ldflags - deploy.sh prompts for major/minor/patch bump, injects version via ldflags into all 4 builds, and writes release/latest JSON file - Add 'pulsewise-collector version' — prints version and checks for update - Add 'pulsewise-collector update' — fetches and applies the latest release - Default version changed to "dev" for local builds without ldflags
Pulsewise Collector
Lightweight system metrics collector that reports CPU, memory, disk, network, and process data to Pulsewise.
Quick Install
curl -sSL https://pulsewise.app/install-collector.sh | TOKEN=your-token sudo -E bash
That's it. The script downloads the binary, writes the config, and starts a systemd service. Hostname is auto-detected.
If you prefer an interactive install (prompts for token and hostname):
curl -sSL https://pulsewise.app/install-collector.sh | sudo bash
What It Collects
Every 30 seconds, the collector sends:
| Category | Metrics |
|---|---|
| System | OS, platform, platform version, kernel version, architecture, virtualization type, CPU model |
| Uptime | Seconds since boot |
| Load average | 1m, 5m, 15m |
| CPU | Overall %, per-core %, core count |
| Memory | Total, available, used, usage % |
| Swap | Total, used, free, usage % |
| Disks | Per mount point: device, fstype, total, free, used, usage % |
| Disk I/O | Read/write bytes, read/write count, IOPS in progress |
| Network | Bytes and packets sent/received per second (rate, not cumulative) |
| Processes | Top 10 by CPU: PID, name, command, CPU%, memory%, CPU time, RSS |
See payload.json for a full example of the JSON sent to the API.
Configuration
Config lives at /etc/pulsewise-collector/config:
TOKEN=your-token-here
All other options are optional:
| Key | Default | Description |
|---|---|---|
TOKEN |
(required) | Your Pulsewise API token |
HOSTNAME |
System hostname | Override the reported hostname |
URL |
https://pulsewise.app/api/collect |
Override the API endpoint |
DEBUG |
false |
Log full response body from the server |
Config file permissions should be 600 (root-only readable).
For local development on macOS, the collector also checks ~/.config/pulsewise-collector/config.
Development
# Create local config
mkdir -p ~/.config/pulsewise-collector
echo "TOKEN=test-token" > ~/.config/pulsewise-collector/config
# Build and run
./build.sh
./pulsewise-collector
To point at a local server:
TOKEN=test-token
URL=http://localhost:8000/api/collect
DEBUG=true
Cross-Compiling
GOOS=linux GOARCH=amd64 go build -o pulsewise-collector-linux-amd64
GOOS=linux GOARCH=arm64 go build -o pulsewise-collector-linux-arm64
Or use ./deploy.sh to compile both architectures and copy them into the Pulsewise Laravel app.
Managing the Service
sudo systemctl status pulsewise-collector
sudo journalctl -u pulsewise-collector -f
sudo systemctl restart pulsewise-collector
sudo systemctl stop pulsewise-collector
How It Works
- Collects metrics every 30 seconds using gopsutil
- Sends JSON via
POSTto the configured URL withAuthorization: Bearer <token> - Network metrics are computed as per-second rates (delta between intervals); the first collection sends
nullfor network - Runs as a systemd service with automatic restart on failure
License
MIT