Welcome to Gearbox! This guide will walk you through setting up your first monitored server or workstation (we call these "Boxes").
Gearbox is a gear-based server monitoring and management platform that consists of two components:
- Gearbox Dashboard - Web interface for monitoring multiple servers (port 3000)
- Gearbox Agent - Lightweight service installed on each Box you want to monitor (port 8405)
- A Linux server or workstation to monitor (the "Box")
- Go 1.21+ installed on the Box (for building the agent)
- Network connectivity between the dashboard and the Box on port 8405
The dashboard is where you'll view and manage all your monitored Boxes.
# Clone the repository
git clone https://github.com/sarg3nt/gearbox.git
cd gearbox/gearbox
# Build the dashboard
make build
# Run the dashboard
./bin/gearboxThe dashboard will be available at http://localhost:3000
Choose the installation method that works best for your environment:
The easiest way to get started with minimal dependencies:
# Pull the latest image
docker pull ghcr.io/sarg3nt/gearbox/gearbox-agent:latest
# Or use Docker Compose (see Step 5 for docker-compose.yml example)See gearbox-agent/docs/docker.md for complete Docker setup guide.
For traditional systemd-based deployments:
# Clone the repository
git clone https://github.com/sarg3nt/gearbox.git
cd gearbox/gearbox-agent
# Build the agent
make build
# The agent binary will be in ./bin/gearbox-agent- Open the Gearbox dashboard at
http://localhost:3000 - Navigate to Settings > Servers and click Add Server
- Click the Generate API Key button
- Copy the generated API key to your clipboard
- Important: Save this key somewhere safe - you won't be able to see it again!
Create a configuration file or set environment variables on your Box:
export GEARBOX_API_KEY="your-generated-api-key-here"
export GEARBOX_PORT="8405" # Optional, defaults to 8405Add these to your shell profile (~/.bashrc, ~/.zshrc) or create a systemd service file to make them persistent.
Create /etc/gearbox-agent/config.yaml:
api_key: "your-generated-api-key-here"
port: 8405Using docker run:
docker run -d \
--name gearbox-agent \
-p 8405:8405 \
-v gearbox-agent-data:/var/lib/gearbox-agent \
-e HAPROXY_AGENT_LOG_LEVEL=info \
ghcr.io/sarg3nt/gearbox/gearbox-agent:latestUsing Docker Compose:
Create docker-compose.yml:
version: '3.8'
services:
gearbox-agent:
image: ghcr.io/sarg3nt/gearbox/gearbox-agent:latest
container_name: gearbox-agent
restart: unless-stopped
ports:
- "8405:8405"
volumes:
- ./data:/var/lib/gearbox-agent
environment:
- HAPROXY_AGENT_LOG_LEVEL=infoThen start:
docker-compose up -d# Start the agent
cd gearbox-agent
./bin/gearbox-agentThe agent will start on port 8405 and begin collecting system metrics.
- Return to the Gearbox dashboard
- In the Add Server form, fill in:
- Server Name: A friendly name (e.g., "Production Web Server")
- Server ID: A unique identifier (e.g., "web-prod-01")
- Agent URL: The URL to your agent (e.g.,
http://192.168.1.100:8405) - API Key: Paste the API key you generated earlier
- Click Test Connection to verify connectivity
- Click Add Server to save
After adding your first Box:
- Navigate to Settings > Gears
- Enable the gears you want to use:
- HAProxy - HAProxy monitoring and statistics
- Metrics - System metrics visualization
- Services - Service management and monitoring
- Certificates - TLS certificate tracking
- Logs - Log aggregation and viewing
- Traffic - Traffic analysis and visualization
- Alerts - Alert management
- OS Updates - OS package updates
When you enable a gear, its page will be added to the navigation.
Create /etc/systemd/system/gearbox-agent.service:
[Unit]
Description=Gearbox Agent - Server Monitoring
After=network.target
[Service]
Type=simple
User=gearbox
WorkingDirectory=/opt/gearbox-agent
Environment="GEARBOX_API_KEY=your-api-key-here"
Environment="GEARBOX_PORT=8405"
ExecStart=/opt/gearbox-agent/bin/gearbox-agent
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetEnable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable gearbox-agent
sudo systemctl start gearbox-agent
sudo systemctl status gearbox-agentGearbox Agent automatically discovers services running on your Box:
- HAProxy - Detects running HAProxy instances and collects stats
- Docker - Discovers Docker containers and images
- System Services - Monitors systemd services
No manual configuration required! Just enable the relevant gears in the dashboard.
- API Key Security: Treat your API key like a password. Never commit it to version control.
- Network Security: Use a firewall to restrict access to port 8405 to only your dashboard server.
- HTTPS: In production, run both the dashboard and agent behind a reverse proxy with HTTPS.
- Authentication: The dashboard supports password authentication and WebAuthn. Enable it for production use.
- Verify the
GEARBOX_API_KEYenvironment variable is set - Check if port 8405 is available:
sudo netstat -tulpn | grep 8405 - Review agent logs for errors
- Verify the Agent URL is correct and accessible from the dashboard server
- Check firewall rules on both the dashboard and Box
- Confirm the API key matches between dashboard and agent
- Use
curlto test:curl http://your-box:8405/health
- Wait 30-60 seconds for the first data collection cycle
- Verify the gear is enabled in Settings > Gears
- Check that the service you're trying to monitor is actually running on the Box
- Review agent logs for collection errors
- Configure Alerts: Set up alert rules for critical metrics
- Add More Boxes: Repeat the process to monitor additional servers
- Documentation: GitHub Repository
- Issues: Report a Bug
- Architecture: See docs/gears.md for gear architecture details
Now that you have Gearbox running, explore:
- Gear Development: Build your own monitoring gears
- Advanced Configuration: Explore environment variables and configuration options
Happy monitoring! 📊