This guide covers how to set up and configure blackbox on a Linux VPS. Whether you're running a production environment or a development setup, these instructions will help you get started quickly and securely.
Prerequisites
- Open ports: 3000 (Grafana), 9090 (Prometheus)
- Root or sudo access to the server
- A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
- Basic familiarity with the Linux command line
- Docker installed (for containerized monitoring)
Stack Installation
The default configuration works well for development environments, but production servers require additional tuning. Pay particular attention to connection limits, timeout values, and logging settings.
# docker-compose.yml for monitoring stack
version: '3.8'
services:
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
ports:
- "9090:9090"
restart: unless-stopped
grafana:
image: grafana/grafana:latest
volumes:
- grafana_data:/var/lib/grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=changeme
restart: unless-stopped
volumes:
prometheus_data:
grafana_data:
The output should show the service running without errors. If you see any warning messages, address them before proceeding to the next step.
- Use connection pooling for database connections
- Profile before optimizing - measure first
- Implement caching at every appropriate layer
Dashboard Configuration
If you encounter issues during setup, check the system logs first. Most problems can be diagnosed by examining the output of journalctl or the application-specific log files in /var/log/.
# prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
- job_name: 'blackbox'
static_configs:
- targets: ['localhost:9090']
Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.
- Test your backup restore procedure monthly
- Keep your system packages updated regularly
- Review log files weekly for anomalies
Alert Rule Setup
If you encounter issues during setup, check the system logs first. Most problems can be diagnosed by examining the output of journalctl or the application-specific log files in /var/log/.
# docker-compose.yml for monitoring stack
version: '3.8'
services:
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
ports:
- "9090:9090"
restart: unless-stopped
grafana:
image: grafana/grafana:latest
volumes:
- grafana_data:/var/lib/grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=changeme
restart: unless-stopped
volumes:
prometheus_data:
grafana_data:
Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.
Performance Considerations
If you encounter issues during setup, check the system logs first. Most problems can be diagnosed by examining the output of journalctl or the application-specific log files in /var/log/.
Wrapping Up
Following this guide, your blackbox setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.