Monitoring containers with Prometheus and Grafana

Architecting Monitoring for Containerized Applications

Why not use Nagios?

Can’t use same method as traditional servers. E.g. putting an agent into a container doesn’t really work.

/metrics exposed for container runtime. Docker uses Prometheus format (i.e. simple text with Key Value format)

Prometheus stores data in time series database.

Prometheus configuration

Is in YAML. E.g.




- job_name: <name here>


scrape_interval: 60s

Prometheus Dashboard

Status > Targets: lists all monitored targets

Graph > Graph > select from insert metric at cursor


Collecting Metrics with Prometheus

Exposing Runtime Metrics with Prometheus

Exposing Application Metrics to Prometheus

Exposing Docker Metrics to Prometheus

Building Dashboards with Grafana




Grafana: notes

Start / stop

sudo service grafana-server restart

Dashboard JSON


Set: Left menu > Configuration > Data Sources

and if you click on the Data Source you’ll see the Settings. E.g.

URL: http://localhost:9000

and you can test this using:

curl http://localhost:9090
<a href="/graph">Found</a>.

When you create (and save) the JSON for a dashboard, you can see it configured. e.g.:

    "datasource": "Prometheus",