AWS Builder Center
Building a Self-Hosted Monitoring Stack with Uptime Kuma, Grafana & Prometheus

Building a Self-Hosted Monitoring Stack with Uptime Kuma, Grafana & Prometheus

A practical guide to building enterprise-grade monitoring for SMBs using open-source tools on Docker, achieving 100% infrastructure visibility at zero monthly cost.

Introduction

As IT consultants serving SMBs in the Permian Basin region, we needed a monitoring solution that was cost-effective, self-hosted, and capable of tracking both internal infrastructure and public-facing services. After evaluating various options, we built a comprehensive monitoring stack using open-source tools that rivals enterprise solutions at a fraction of the cost.
This article walks through our implementation of Uptime Kuma for availability monitoring, Grafana for visualization, and Prometheus for metrics collection—all running on a single Ubuntu server using Docker containers.

Why Self-Hosted Monitoring?

Before diving into the technical implementation, let's address why we chose self-hosting over SaaS alternatives:
  • Cost Control: No per-monitor pricing or monthly subscriptions
  • Data Sovereignty: All monitoring data stays within our infrastructure
  • Customization: Full control over alerting rules, retention policies, and dashboards
  • Learning Opportunity: Deep understanding of the monitoring stack
  • Compliance: Essential for HIPAA and CJIS environments where data must remain on-premises

Architecture Overview

Our monitoring stack consists of three primary components:
  1. Uptime Kuma - Lightweight uptime monitoring for HTTP, TCP, DNS, and PING checks
  2. Prometheus - Time-series database for collecting and storing metrics
  3. Grafana - Visualization platform for creating dashboards and alerts
All services run as Docker containers on an Ubuntu 24.04 server (Lenovo ThinkCentre M900 Tiny), orchestrated through Portainer for easy management.

Implementation

Docker Compose Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
version: '3.8'
services:
uptime-kuma:
image: louislam/uptime-kuma:latest
ports:
- '3001:3001'
volumes:
- uptime-kuma-data:/app/data
restart: unless-stopped

prometheus:
image: prom/prometheus:latest
ports:
- '9090:9090'
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
restart: unless-stopped

grafana:
image: grafana/grafana:latest
ports:
- '3030:3000'
volumes:
- grafana-data:/var/lib/grafana
restart: unless-stopped

Uptime Kuma Setup

Uptime Kuma provides an intuitive web interface for configuring monitors. We automated our monitor creation using the uptime-kuma-api Python library:
  1. Install the Python API client
  2. Create a configuration script with all monitors defined
  3. Execute the script to provision monitors in seconds
This automation approach allows us to replicate our monitoring configuration across environments or quickly rebuild after system changes.

What We Monitor

Our current monitoring covers 15+ endpoints across different categories:
Infrastructure:
  • Ubuntu Server (PING)
  • UCG Ultra Gateway (PING)
  • U7 Pro WiFi Access Point (PING)
Services:
  • Portainer, Grafana, Prometheus (HTTP)
  • Nginx Proxy Manager, Gitea (HTTP)
  • RustDesk Server (PORT checks)
  • PostgreSQL Database (PORT)
Public Websites:
  • pedroitsolutions.com (HTTPS)
  • portal.pedroitsolutions.com (HTTPS)
  • windowscleanerpro.com (HTTPS)

Results & Benefits

After implementing this monitoring stack, we achieved:
  • 100% visibility into our infrastructure health
  • Instant alerts when services go down
  • Historical data for trend analysis and capacity planning
  • Professional status pages for clients
  • $0 monthly cost compared to $50-200/month for equivalent SaaS solutions

Lessons Learned

  1. Automate Everything: Script your monitor creation. Manual setup doesn't scale.
  2. Start Simple: Begin with basic availability checks, then add metrics.
  3. Document Your Setup: Keep docker-compose files and configs in version control.
  4. Plan for Persistence: Always mount volumes for data that needs to survive container restarts.

Conclusion

Building a self-hosted monitoring stack is an excellent way to gain visibility into your infrastructure while maintaining full control over your data. The combination of Uptime Kuma, Prometheus, and Grafana provides enterprise-grade monitoring capabilities without the enterprise price tag.
For SMBs and IT consultants looking to level up their monitoring game, this stack offers the perfect balance of simplicity and power.

Pedro Luis Hernandez Pimienta is the founder of Pedro IT Solutions, a cybersecurity and IT consulting firm based in Odessa, Texas. Connect at pedroitsolutions.com
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article