Monitoring Stack Project
Monitoring Stack Project
Project Architecture-
Tech Stack-
- Name : monitoring-server
- AMI Type : Ubuntu 24.04
- Instance type : t2.medium
- Generate new key pair(.pem)
- Configure Storage : 20Gb
- Launch Instance
- cd ..
- nano docker-compose.yml
- Above service is for only application and will run in user-defined network called
“monitoring”.
- Run the docker-compose.yml file,
- Prometheus has its own configuration which need to be configure and copy it
into the prometheus’s container.
- Install prometheus using Docker container in compose file,
- nano docker-compose-yml
- pwd : /home/ubuntu/observability
- nano prometheus.yml
- In this scrape_configs, we need to add target of cAdvisor which already have metrics
of docker containers.
1. Map Format
2. Table Format
Adding Node Exporter service in prometheus as target,
- pwd : /home/ubuntu/observability
- nane docker-compose.yml
- nano docker-compose.yml
- Add new data source as Prometheus, so that Grafana can visualize metrics.
- Go to Home -> Connections
- Add Prometheus data source,
- Build Dashboard,
- Click on “Add visualization”
- Select “Data Source” as Prometheus
- container_memory_usage_bytes{name="notes-app"}
- Select visualization,
- Click on “Apply”.
Import Dashboard in Grafana
- Load dashboard
- Select datasource as “Prometheus”
- Import
- Dashboard should be,
Setup Loki and Promtail using Docker,
- As prometheus has config file, as same Loki and promtail also have config file. Hence
we need to download these files.
wget https://raw.githubusercontent.com/grafana/loki/v2.8.0/cmd/loki/loki-local-config.yaml -O
loki-config.yaml
- Promtail
wget https://raw.githubusercontent.com/grafana/loki/v2.8.0/clients/cmd/promtail/promtail-
docker-config.yaml -O promtail-config.yaml
- Now, add container for Loki and Promtail in docker compose file.
- docker compose down
- docker compose up -d
Ojas Jawale