Containers metrics with Prometheus and Grafana

1. What is Prometheus?

  • Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud.
  • The main Prometheus server which scrapes and stores time series data.
  • Prometheus is designed for reliability, to be the system you go to during an outage to allow you to quickly diagnose problems.
  • Prometheus is using its own query language called PromQL.

2. What is Grafana?

  • Grafana is a multi-platform open source analytics and interactive visualization software.
  • It provides charts, graphs, and alerts for the web when connected to supported data sources.

3. Prometheus + Grafana

  • Grafana supports querying Prometheus.
  • The Grafana data source for Prometheus is included since Grafana 2.5.0.

4. Exporters

5. CAdvisor

Earlier, We used prom/container-exporter to get container metrics. This is deprecated. 

6. Setup the Environment

1. cadvisor

docker-compose up
cadvisor web UI
graphs on cAdvisor web UI
cadvisor metrics

2. Prometheus

  • In here, I am using prometheus.yml to add my own custom configurations. Using this config file, I have added targets of scrape_configs for cadvisor and default prometheus metrics.
  • scrape_interval is 5 second. So every 5 second, prometheus is going to scrape metrics.
  • According to below config, prometheus knows which metrics it is going to scrape.
docker-compose up

3. Grafana

4. Container memory

5. Conainer CPU

6. Container I/O metrics

container I/O graph

References

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store