A production-grade, open source Go agent that collects comprehensive system metrics and sends them to the WatchUp monitoring platform. The agent uses secure device linking authentication and runs as a lightweight background service.
WatchUp Agent is fully open source under the MIT License. You can:
- ✅ Audit the code for security and functionality
- ✅ Customize and modify for your specific needs
- ✅ Contribute features and improvements
- ✅ Self-host against custom backends
- ✅ Use in enterprise environments with confidence
The agent integrates with the WatchUp platform (proprietary) but can be adapted for other monitoring backends.
- Device Linking Authentication: Secure one-time setup similar to GitHub CLI
- Comprehensive System Metrics: CPU, Memory, Disk, Network monitoring
- Extended Network Monitoring: Active connections, port checks, latency monitoring
- Real-time Collection: Configurable intervals (1s to hours)
- Robust Communication: Retry logic with exponential backoff
- Production Ready: Graceful shutdown, error handling, comprehensive logging
- Lightweight: Minimal resource usage (<5% CPU, <50MB RAM)
- Cross-platform: Works on Windows, Linux, macOS
curl -fsSL https://raw.githubusercontent.com/tomurashigaraki22/watchup-agent-v2/main/install.sh | bashiwr -useb https://raw.githubusercontent.com/watchup/watchup-agent/main/install.ps1 | iex-
Download the latest release for your platform:
- Visit Releases
- Download the appropriate binary:
- Linux:
watchup-agent-linux-amd64 - macOS:
watchup-agent-darwin-amd64orwatchup-agent-darwin-arm64 - Windows:
watchup-agent-windows-amd64.exe
- Linux:
-
Install the binary:
Linux/macOS:
# Make executable chmod +x watchup-agent-* # Move to system path sudo mv watchup-agent-* /usr/local/bin/watchup-agent
Windows:
# Move to Program Files Move-Item watchup-agent-windows-amd64.exe "C:\Program Files\WatchUp\watchup-agent.exe"
-
Create configuration:
# Download example config curl -fsSL https://raw.githubusercontent.com/watchup/watchup-agent/main/config.example.yaml -o config.yaml # Edit config.yaml and set your server_id nano config.yaml
-
Run the agent:
./watchup-agent
-
Prerequisites:
- Go 1.19 or later
- Git
-
Clone and build:
git clone https://github.com/tomurashigaraki22/watchup-agent-v2.git cd watchup-agent go build -o watchup-agent cmd/agent/main.go cmd/agent/setup.go -
Run:
./watchup-agent
-
Configure server ID:
- Agent will prompt for a server ID if not configured
- Enter a unique identifier for your server (e.g., "web-prod-01")
- Important: Server ID must be unique within your WatchUp account
-
Link to your account:
- Visit the provided URL in your browser
- Enter the displayed code to approve the agent
- Agent will start collecting metrics automatically
Note: Each agent is linked to your WatchUp user account. The server_id you choose must be unique within your account but can be reused by other users.
# Create service file
sudo tee /etc/systemd/system/watchup-agent.service > /dev/null <<EOF
[Unit]
Description=WatchUp Monitoring Agent
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/watchup-agent
WorkingDirectory=/etc/watchup-agent
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
# Start and enable service
sudo systemctl daemon-reload
sudo systemctl start watchup-agent
sudo systemctl enable watchup-agent
# Check status
sudo systemctl status watchup-agent
# View logs
sudo journalctl -u watchup-agent -f# Create plist file
tee ~/Library/LaunchAgents/com.watchup.agent.plist > /dev/null <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.watchup.agent</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/watchup-agent</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
EOF
# Load service
launchctl load ~/Library/LaunchAgents/com.watchup.agent.plist
# Check status
launchctl list | grep watchup# Install as Windows Service
sc.exe create WatchUpAgent binPath= "C:\Program Files\WatchUp\watchup-agent.exe" start= auto
# Start service
Start-Service WatchUpAgent
# Check status
Get-Service WatchUpAgentSee config.example.yaml for all available options.
server_id: Unique identifier for this serverendpoint: Your backend API URLinterval: How often to send metrics (e.g., "5s", "1m")metrics: Which metrics to collect (cpu, memory, disk, network, connections)
ports: List of ports to monitor for availabilitylatency_checks: List of hosts/services to check latency
Example:
# Enable connection monitoring
metrics:
connections: true
# Monitor specific ports
ports:
- port: 80
name: "HTTP"
host: "localhost"
- port: 443
name: "HTTPS"
host: "mysite.com"
# Check latency to external services
latency_checks:
- host: "8.8.8.8"
name: "Google DNS"
type: "tcp"
port: 53
- host: "https://api.myservice.com"
name: "My API"
type: "http"This project is being built in phases:
- Phase 0: Project Setup & Foundation ✅
- Phase 1: Authentication System (Device Linking) ✅
- Phase 2: Core Metrics Collection ✅
- Phase 3: Main Agent Loop & Communication ✅
- Phase 4: Network Monitoring (Extended) ✅
- Phase 5: Process Monitoring
- Phase 6: Service Monitoring
- Phase 7: Deployment & Production Readiness
- Phase 8: Testing & Refinement
watchup-agent/
├── cmd/agent/ # Main application entry point
├── internal/
│ ├── auth/ # Authentication & device linking
│ ├── config/ # Configuration management
│ ├── metrics/ # System metrics collection
│ └── client/ # HTTP client & communication
├── config.yaml # Agent configuration
└── README.md
- Go 1.19 or later
- Network access to WatchUp backend API
- Standard user permissions (no root required for basic metrics)
We welcome contributions! This is an open source project under the MIT License.
- Bug Reports: Use GitHub Issues
- Feature Requests: Describe your use case in an issue
- Code Contributions: Fork, create a feature branch, and submit a PR
- Documentation: Help improve our docs and examples
-
Fork and clone:
git clone https://github.com/YOUR_USERNAME/watchup-agent.git cd watchup-agent -
Install dependencies:
go mod download
-
Make your changes:
# Create a feature branch git checkout -b feature/amazing-feature # Make your changes # ... # Test your changes go test ./...
-
Build and test:
# Build for your platform go build -o watchup-agent cmd/agent/main.go cmd/agent/setup.go # Test the binary ./watchup-agent
-
Build for all platforms (optional):
# Linux/macOS ./build.sh # Windows .\build.ps1
-
Submit a pull request:
git add . git commit -m "Add amazing feature" git push origin feature/amazing-feature
Then open a PR on GitHub!
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run specific package tests
go test ./internal/metrics/
# Run with verbose output
go test -v ./...- Follow standard Go conventions
- Use
gofmtto format code - Add comments for exported functions
- Write tests for new functionality
See CONTRIBUTING.md for detailed guidelines.
-
Tag a new version:
git tag v1.0.0 git push origin v1.0.0
-
GitHub Actions will automatically:
- Build binaries for all platforms
- Create a GitHub release
- Upload all binaries as release assets
# Build all platforms
./build.sh v1.0.0
# Binaries will be in dist/
ls dist/| OS | Architecture | Binary Name |
|---|---|---|
| Linux | amd64 | watchup-agent-linux-amd64 |
| Linux | arm64 | watchup-agent-linux-arm64 |
| Linux | armv7 | watchup-agent-linux-armv7 |
| macOS | amd64 (Intel) | watchup-agent-darwin-amd64 |
| macOS | arm64 (M1/M2) | watchup-agent-darwin-arm64 |
| Windows | amd64 | watchup-agent-windows-amd64.exe |
| Windows | arm64 | watchup-agent-windows-arm64.exe |
This project is licensed under the MIT License - see the LICENSE file for details.
- WatchUp Platform: https://watchup.site
- Documentation: MONITORING_CAPABILITIES.md
- Deployment Guide: DEPLOYMENT.md
- Architecture: OPEN_SOURCE_ARCHITECTURE.md
- Contributing: CONTRIBUTING.md
- Issues: GitHub Issues
- Documentation: Check the docs in this repository
- Community: GitHub Discussions
- Issues: GitHub Issues for bugs and feature requests
- Security: Email security@watchup.com for security issues
Made with ❤️ by the WatchUp team and contributors