WinDash Agent
Lightweight Windows system monitoring agent - Send real-time PC metrics to your WinDash dashboard
π Quick Start
For Windows Users
- Download the latest
WinDash-Agent.exe from Releases
- Double-click
WinDash-Agent.exe to run it
- Approve the device in your browser (opens automatically to
windash.jcdorr3.dev)
- Done! The agent is now sending metrics to your dashboard
The agent runs in the console window. Press Ctrl+C to stop it.
π What It Does
The WinDash Agent collects and sends these metrics to your dashboard every 2 seconds:
- CPU - Total and per-core usage %
- Memory - Used and total RAM
- Disk - Space used/available for all drives
- Network - Upload/download speeds (bytes/sec)
- System - Uptime and process count
βοΈ Configuration
The agent creates a config file on first run:
Windows: %LOCALAPPDATA%\WinDash\agent.json
{
"dashboardUrl": "https://windash.jcdorr3.dev",
"apiUrl": "wss://windash.jcdorr3.dev/agent",
"metricsIntervalMs": 2000,
"openOnStart": true
}
Options
dashboardUrl - Your WinDash dashboard URL
apiUrl - WebSocket endpoint for metrics
metricsIntervalMs - How often to collect metrics (minimum 1000ms)
openOnStart - Open dashboard in browser when agent starts
π Logs
Logs are automatically saved and rotated (keeps last 7 days):
Windows: %ProgramData%\WinDash\logs\agent.log
π Security
- Authentication tokens are stored securely in Windows Credential Manager (DPAPI)
- All communication uses WSS (WebSocket Secure) with your backend
- No sensitive data is collected - only system performance metrics
- Open source - You can review all the code!
π οΈ For Developers
Prerequisites
- Go 1.22 or higher (uses Go 1.24 for latest features)
- Git
Build from Source
# Clone the repository
git clone https://github.com/jcdorr003/windash-agent.git
cd windash-agent
# Download dependencies
go mod download
# Run in development mode
make dev
# or
go run ./cmd/agent
# Build for Windows
make build-windows
# Build for all platforms
make build-all
Project Structure
windash-agent/
βββ cmd/agent/ # Main application entry point
βββ internal/
β βββ auth/ # Pairing & token management
β βββ config/ # Configuration loading
β βββ metrics/ # System metrics collection
β βββ ws/ # WebSocket client
β βββ tray/ # System tray (optional)
βββ pkg/log/ # Logging utilities
Development Commands
make dev # Run in development mode
make build # Build for current platform
make build-windows # Build Windows executable
make build-all # Build for all platforms (requires goreleaser)
make clean # Clean build artifacts
make lint # Run linters
make test # Run tests
make deps # Download/update dependencies
Build Variables
The build injects version info via ldflags:
go build -ldflags "-X main.version=1.0.0 -X main.buildTime=$(date -u +%Y-%m-%d_%H:%M:%S)"
π§ Architecture
Pairing Flow
- First Run: Agent requests device code from backend (currently using mock - returns instant code)
- Browser Opens: User is directed to pairing page at
windash.jcdorr3.dev/pair?code=XXXX-XXXX
- User Approves: In the WinDash dashboard (backend integration pending)
- Token Issued: Backend issues authentication token
- Token Stored: Securely saved in Windows Credential Manager via DPAPI
- Subsequent Runs: Token reused automatically, no re-pairing needed
Current Status
- β
Pairing UI Flow: Opens browser to correct URL
- β³ Backend Integration: Mock API simulates 6-second approval (replace with real API)
- β
Token Storage: Windows Credential Manager integration working
- β³ WebSocket: Client ready, waiting for backend endpoint
Metrics Collection
- Uses
gopsutil/v4 for cross-platform system metrics
- Collects samples every 2 seconds (configurable via
metricsIntervalMs)
- Network rates calculated from byte deltas between collections
- Stable
hostId generated from machine ID (persists across reboots)
- Zero-allocation metric collection for optimal performance
WebSocket Client
- Auto-reconnect with exponential backoff (1s β 2min) + 20% jitter
- Backpressure handling: drops oldest samples if buffer full (warns every 10 drops)
- Batch sending: sends up to 10 samples per WebSocket message
- Heartbeat: pings every 10 seconds to keep connection alive
- Compression: permessage-deflate enabled
- Graceful shutdown: closes connection cleanly on Ctrl+C
π¦ Release Process
# Tag a new version
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0
# Build release (requires goreleaser)
goreleaser release
# Or build snapshot for testing
goreleaser release --snapshot --clean
πΊοΈ Roadmap
- Core metrics collection (CPU, RAM, Disk, Network)
- WebSocket client with reconnect
- Secure token storage
- Mock pairing flow
- Real backend API integration
- System tray (optional)
- Auto-update
- Windows installer
- Start with OS (autostart)
- macOS & Linux support
π License
See LICENSE file.
π Troubleshooting
Agent won't start
- Check logs in
%ProgramData%\WinDash\logs\agent.log
- Try running with
--debug flag for verbose output
- Ensure no firewall blocking outbound connections
Pairing fails
- Verify dashboard URL in config is correct
- Check internet connection
- Try deleting
agent.json and restarting (re-pairs device)
Metrics not showing
- Check WebSocket connection in logs
- Verify API URL in config
- Ensure backend is running and accessible
π¬ Support
Made with β€οΈ for Windows PC monitoring