- Notifications
You must be signed in to change notification settings - Fork 8
Setup Guide ‐ DevOps Monitoring in a Box
Before you begin, ensure you have the following installed on your system:
- Docker (version 20.10 or higher)
- Docker Compose (version 2.0 or higher)
- RAM: Minimum 2GB, Recommended 4GB+
- Storage: At least 5GB free space
- Ports: Ensure ports 3000, 9090, 3100, 9093, 8080, 9100 are available
# Update package index sudo apt update # Install prerequisites sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release # Add Docker's official GPG key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # Add Docker repository echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # Install Docker sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io # Start and enable Docker sudo systemctl start docker sudo systemctl enable docker # Add user to docker group (optional, for non-sudo usage) sudo usermod -aG docker $USER# Install prerequisites sudo yum install -y yum-utils # Add Docker repository sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # Install Docker sudo yum install docker-ce docker-ce-cli containerd.io # Start and enable Docker sudo systemctl start docker sudo systemctl enable docker# Install using Homebrew brew install --cask docker # Or download from https://www.docker.com/products/docker-desktopDownload and install Docker Desktop from https://www.docker.com/products/docker-desktop
# Install Docker Compose sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose # Make it executable sudo chmod +x /usr/local/bin/docker-compose # Verify installation docker-compose --versionDocker Compose is included with Docker Desktop.
# Clone the repository git clone https://github.com/<your-username>/devops-monitoring-in-a-box.git cd devops-monitoring-in-a-box # Make scripts executable chmod +x start.sh stop.sh # Start the monitoring stack ./start.sh./start.sh# Start all services docker-compose up -d # Check status docker-compose ps # View logs docker-compose logs -fOnce all services are running, you can access:
| Service | URL | Default Credentials |
|---|---|---|
| Grafana | http://localhost:3000 | admin / admin |
| Prometheus | http://localhost:9090 | None |
| Loki | http://localhost:3100 | None |
| Alertmanager | http://localhost:9093 | None |
| cAdvisor | http://localhost:8080 | None |
| Node Exporter | http://localhost:9100 | None |
- Node Exporter Dashboard: Pre-configured with system metrics
- Prometheus Data Source: Already configured and ready to use
- Loki Data Source: Ready for log queries
- Targets: All services automatically discovered
- Alerts: Pre-configured alert rules for system monitoring
- Metrics: Real-time system and container metrics
- System Logs: Collection from various log sources
- Container Logs: Docker container log aggregation
- Search: Log querying and filtering
Edit alertmanager/config.yml to configure:
- Slack webhooks
- Email notifications
- Alert routing rules
To add additional exporters (MySQL, Redis, etc.):
- Add the service to
docker-compose.yml - Add scrape configuration to
prometheus/prometheus.yml - Create custom dashboards in Grafana
- Place JSON dashboard files in
grafana/dashboards/ - They will be automatically loaded by Grafana
# Check Docker status docker info # Check service logs docker-compose logs [service-name] # Check port availability netstat -tulpn | grep :3000# Check if Grafana is running docker-compose ps grafana # Check Grafana logs docker-compose logs grafana # Verify port binding docker port grafana# Check Prometheus logs docker-compose logs prometheus # Verify network connectivity docker-compose exec prometheus wget -qO- http://node-exporter:9100/metrics# Check resource usage docker stats # Adjust resource limits in docker-compose.yml# Stop and remove all containers docker-compose down # Remove all volumes (WARNING: This will delete all data) docker-compose down -v # Remove all images docker-compose down --rmi all # Start fresh ./start.sh- Instrument your application with Prometheus client libraries
- Add scrape configuration to
prometheus/prometheus.yml - Create custom dashboards in Grafana
- job_name: 'my-app' static_configs: - targets: ['my-app:8080'] metrics_path: '/metrics' scrape_interval: 15s- Configure your application to output structured logs
- Update Promtail config in
loki/promtail-config.yml - Query logs in Grafana using Loki
- Change default passwords for all services
- Use secrets management for sensitive configuration
- Restrict network access with firewalls
- Enable TLS/SSL for all services
- Use reverse proxy (nginx, traefik) for external access
Create a .env file for sensitive configuration:
GRAFANA_ADMIN_PASSWORD=your-secure-password SLACK_WEBHOOK_URL=your-slack-webhook SMTP_PASSWORD=your-smtp-password- Kubernetes Deployment: Create K8s manifests
- Terraform Automation: Infrastructure as Code
- CI/CD Integration: Automated deployment
- Custom Dashboards: Build specialized visualizations
- Alert Rules: Create business-specific alerts
- GitHub Issues: Report bugs and request features
- Discord: Join our community server
- Documentation: Check the README and this guide
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Happy Monitoring! 🚀
If you find this project helpful, please give it a ⭐ on GitHub!
Built with passion and purpose by Harshhaa.
Your ideas, feedback, and contributions are what make this project better.
Let’s shape the future of DevOps monitoring together! 🚀
Connect & Collaborate:
- GitHub: @NotHarshhaa
- Blog: ProDevOpsGuy
- Telegram Community: Join Here
- LinkedIn: Harshhaa Vardhan Reddy
If you found this project useful:
- ⭐ Star the repository to show your support
- 📢 Share it with your friends and colleagues
- 📝 Open issues or submit pull requests to help improve it
Join the community, share your experience, and help us grow!
- 🏠 Home
