All case studiesLab project
Observability Platform
A self-hosted monitoring and logging stack with Prometheus, Grafana, Loki, Grafana Alloy, Node Exporter, and cAdvisor — covering host metrics, container metrics, centralized logs, dashboards, and alerting.
- Prometheus
- Grafana
- Loki
- Grafana Alloy
- Node Exporter
- cAdvisor
This is a personal lab build used to practise and demonstrate the approach. It describes architecture and decisions, not results from a client engagement.
Problem
Without central metrics or logs, diagnosing an incident meant SSH-ing into individual machines and reading log files by hand — usually after users had already noticed.
Architecture
- Collection
- Node Exporter
- cAdvisor
- Grafana Alloy
- Storage
- Prometheus (metrics)
- Loki (logs)
- Visualization
- Grafana dashboards
- Alerting
- Prometheus alert rules
- Grafana notifications
Technical decisions
- Metrics and logs in one place
- Grafana queries both Prometheus and Loki, so a spike on a dashboard can be followed straight into the related logs.
- Grafana Alloy as the log and telemetry agent
- A single agent ships container and system logs to Loki with consistent labels, simplifying the collection layer.
- Alert on symptoms, not noise
- Alerts focus on user-impacting conditions (targets down, sustained errors, disk exhaustion) rather than every metric fluctuation.
Implementation
- Deployed the stack with Docker Compose and persistent volumes for metrics and log storage.
- Configured Prometheus scrape targets for hosts and containers.
- Set up Alloy pipelines to label and ship logs to Loki.
- Built Grafana dashboards for host resources, container health, and application logs.
- Defined alert rules and notification routing.
Security considerations
- Monitoring endpoints kept on an internal network, not exposed publicly.
- Grafana protected by authentication with the default admin credentials changed.
- Retention configured so logs are not kept longer than needed.
Operational benefits
- One place to see host, container, and application health.
- Faster root-cause analysis by correlating metrics with logs.
- Problems surface through alerts instead of user reports.
Lessons learned
- Label cardinality matters — unbounded labels quietly degrade Prometheus and Loki.
- Dashboards are most useful when designed around specific questions an on-call engineer asks.