SlideShare a Scribd company logo
Prometheus and Docker
Monitoring and Management
Brian Brazil
Founder
Who am I?
Engineer passionate about running software reliably in production.
● TCD CS Degree
● Google SRE for 7 years, working on high-scale reliable systems such as
Adwords, Adsense, Ad Exchange, Billing, Database
● Boxever TL Systems&Infrastructure, applied processes and technology to let
allow company to scale and reduce operational load
● Contributor to many open source projects, including Prometheus, Ansible,
Python, Aurora and Zookeeper.
● Founder of Robust Perception, making scalability and efficiency available to
everyone
Why monitor?
● Know when things go wrong
β—‹ To call in a human to prevent a business-level issue, or prevent an issue in advance
● Be able to debug and gain insight
● Trending to see changes over time, and drive technical/business decisions
● To feed into other systems/processes (e.g. QA, security, automation)
Common Monitoring Challenges
Themes common among companies I’ve talk to:
● Monitoring tools are limited, both technically and conceptually
● Tools don’t scale well and are unwieldy to manage
● Operational practices don’t align with the business
For example:
Your customers care about increased latency and it’s in your SLAs. You can only
alert on individual machine CPU usage.
Result: Engineers continuously woken up for non-issues, get fatigued
Fundamental Challenge is Limited Visibility
Prometheus
Inspired by Google’s Borgmon monitoring system.
Started in 2012 by ex-Googlers working in Soundcloud as an open source project,
mainly written in Go. Publically launched in early 2015, and continues to be
independent of any one company.
Over 100 companies have started relying on it since then.
What does Prometheus offer?
● Inclusive Monitoring
● Manageable and Reliable
● Easy to integrate with
● Dashboards
● Powerful data model
● Powerful query language
● Efficient
● Scalable
Services have Internals
Monitor the Internals
Monitor as a Service, not as Machines
Inclusive Monitoring
Don’t monitor just at the edges:
● Instrument client libraries
● Instrument server libraries (e.g. HTTP/RPC)
● Instrument business logic
Library authors get information about usage.
Application developers get monitoring of common components for free.
Dashboards and alerting can be provided out of the box, customised for your
organisation!
Python Instrumentation Example
pip install prometheus_client
from prometheus_client import Summary, start_http_server
REQUEST_DURATION = Summary('request_duration_seconds',
'Request duration in seconds')
@REQUEST_DURATION.time()
def my_handler(request):
pass # Your code here
start_http_server(8000)
Manageable and Reliable
Core Prometheus server is a single binary.
Doesn’t depend on Zookeeper, Consul, Cassandra, Hadoop or the Internet.
Only requires local disk (SSD recommended). No potential for cascading failure.
Pull based, so easy to on run a workstation for testing and rogue servers can’t
push bad metrics.
Advanced service discovery finds what to monitor.
Running Prometheus with Docker
Docker images at https://hub.docker.com/r/prom/
To run Prometheus:
docker run -p 9090:9090 prom/prometheus:latest
This monitors itself.
http://localhost:9090/consoles/prometheus.html has a console.
Easy to integrate with
Many existing integrations: Java, JMX, Python, Go, Ruby, .Net, Machine,
Cloudwatch, EC2, MySQL, PostgreSQL, Haskell, Bash, Node.js, SNMP, Consul,
HAProxy, Mesos, Bind, CouchDB, Django, Mtail, Heka, Memcached, RabbitMQ,
Redis, RethinkDB, Rsyslog, Meteor.js, Minecraft...
Graphite, Statsd, Collectd, Scollector, Munin, Nagios integrations aid transition.
It’s so easy, most of the above were written without the core team even knowing
about them!
Cadvisor natively supports Prometheus
Run Cadvisor:
docker run -v /var/run/:/var/run -v /sys:/sys -p 8080:8080
google/cadvisor
http://localhost:8080/metrics will have metrics for all your containers
Service Discovery
It’s vital to know where each of your instances is meant to be running.
Systems such as Docker Swarm spread applications across machines, so we
need some form of service discovery to find them.
Both Swarm and Prometheus support Consul, so let’s try that.
Setting up Swarm on localhost (1)
MY_IP=1.2.3.4
# - Run consul
docker run -d --name=consul --net=host gliderlabs/consul-server 
-bootstrap
# - Pass the docker daemon -H tcp://0.0.0.0:2375 so it’ll do TCP
# - Register services in Consul
docker run -d --net=host -v /var/run/docker.sock:/tmp/docker.sock 
gliderlabs/registrator consul://localhost:8500
# - Join the swarm
docker run -d swarm join --addr=$MY_IP:2375 
consul://$MY_IP:8500/swarm
Setting up Swarm on localhost (2)
# - Run some machine monitoring
docker run -d -v /var/run/:/var/run -v /sys:/sys -p 8080:8080 
google/cadvisor
docker run -d -v /:/rootfs:ro -p 9100:9100 --net=host 
-e SERVICE_NAME=node prom/node-exporter
# - Start the Swarm Manager
docker run -d -p 2376:2375 swarm manage consul://$MY_IP:8500/swarm
# - Check it’s working
docker -H tcp://127.0.0.1:2376 info
Prometheus configuration to use Consul
scrape_configs:
- job_name: 'consul'
consul_sd_configs:
- server: 127.0.0.1:8500
relabel_configs:
- source_labels: [__meta_consul_service]
regex: (.*) # Default next release
replacement: $1 # Default next release
target_label: job
Run Prometheus
docker run -d --net=host -p 9090:9090 
-e SERVICE_NAME=prometheus 
robustperception/prometheus_local_consul
Visit http://localhost:9090/status to see it running
Automatic service discovery!
Dashboards
Many Dashboarding Options
● Grafana
β—‹ Latest release has full Prometheus support
● Promdash
β—‹ Prometheus-specific Ruby-on-Rails dashboarding solution
β—‹ Direction is moving towards Grafana instead
● Console templates
β—‹ Templating language inside Prometheus
β—‹ Good for having your dashboards checked in, and for fully-custom dashboards
● Expression Browser
β—‹ Included in Prometheus, good for ad-hoc debugging
● Roll your own
β—‹ JSON API
Powerful Data Model
All metrics have arbitrary multi-dimensional labels.
No need to force your model into dotted strings.
Can aggregate, cut, and slice along them.
Supports any double value, labels support full unicode.
Example: Labels from Node Exporter
Powerful Query Language
Can multiply, add, aggregate, join, predict, take quantiles across many metrics in
the same query. Can evaluate right now, and graph back in time.
Answer questions like:
● What’s the 95th percentile latency in the European datacenter?
● How full will the disks be in 4 hours?
● Which services are the top 5 users of CPU?
Can alert based on any query.
Example: Top 5 Docker images by CPU
topk(5,
sum by (image)(
rate(container_cpu_usage_seconds_total{
id=~"/system.slice/docker.*"}[5m]
)
)
)
Efficient
Instrumenting everything means a lot of data.
Prometheus is best in class for lossless storage efficiency, 3.5 bytes per datapoint.
A single server can handle:
● millions of metrics
● hundreds of thousands of datapoints per second
Scalable
Prometheus is easy to run, can give one to each team in each datacenter.
Federation allows pulling key metrics from other Prometheus servers.
When one job is too big for a single Prometheus server, can use
sharding+federation to scale out. Needed with thousands of machines.
Final Thought: Instrument Once, Use Everywhere
When an application is instrumented, tends to be limited in which monitoring
systems it supports.
You’re left with a choice: Have N monitoring systems, or run extra services to act
as shims to translate.
Prometheus clients aren’t just limited to outputting metrics in the Prometheus
format, can also output to Graphite and other monitoring systems. Prometheus
clients can also take in metrics from other monitoring systems.
Prometheus clients can be your instrumentation and metrics interchange, even
when not using Prometheus itself!
What do we do?
Robust Perception provides consulting and training to give you confidence in your
production service's ability to run efficiently and scale with your business.
We can help you:
● Decide if Prometheus is for you
● Manage your transition to Prometheus and resolve issues that arise
● With capacity planning, debugging, infrastructure etc.
We are proud to be among the core contributors to the Prometheus project.
Resources
Official Project Website: prometheus.io
Official Mailing List: prometheus-developers@googlegroups.com
Demo: demo.robustperception.io
Dockerfiles: https://github.com/RobustPerception/docker_examples
Robust Perception Website: www.robustperception.io
Queries: prometheus@robustperception.io

More Related Content

PDF
Monitoring your Python with Prometheus (Python Ireland April 2015)
PDF
Prometheus Overview
PDF
Better Monitoring for Python: Inclusive Monitoring with Prometheus (Pycon Ire...
PDF
Systems Monitoring with Prometheus (Devops Ireland April 2015)
PDF
Monitoring with prometheus
PDF
Infrastructure & System Monitoring using Prometheus
PPTX
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
PPTX
MeetUp Monitoring with Prometheus and Grafana (September 2018)
Monitoring your Python with Prometheus (Python Ireland April 2015)
Prometheus Overview
Better Monitoring for Python: Inclusive Monitoring with Prometheus (Pycon Ire...
Systems Monitoring with Prometheus (Devops Ireland April 2015)
Monitoring with prometheus
Infrastructure & System Monitoring using Prometheus
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
MeetUp Monitoring with Prometheus and Grafana (September 2018)

What's hot (20)

PPTX
Prometheus design and philosophy
PPT
Monitoring using Prometheus and Grafana
PDF
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
PDF
Prometheus – a next-gen Monitoring System
PPTX
Prometheus and Grafana
ODP
Monitoring With Prometheus
PPTX
Monitoring With Prometheus
PDF
Getting Started Monitoring with Prometheus and Grafana
PDF
Apache Airflow
PDF
How I learned to time travel, or, data pipelining and scheduling with Airflow
Β 
PDF
Monitoring Kubernetes with Prometheus
PDF
Prometheus monitoring
PPTX
An Introduction to Prometheus (GrafanaCon 2016)
PDF
Explore your prometheus data in grafana - Promcon 2018
PPTX
Comprehensive Terraform Training
PPTX
Prometheus (Prometheus London, 2016)
PPTX
Prometheus in Practice: High Availability with Thanos (DevOpsDays Edinburgh 2...
PDF
[μ˜€ν”ˆμ†ŒμŠ€μ»¨μ„€νŒ…] μΏ λ²„λ„€ν‹°μŠ€μ™€ μΏ λ²„λ„€ν‹°μŠ€ on μ˜€ν”ˆμŠ€νƒ 비ꡐ 및 ꡬ좕 방법
PPTX
Kubernetes & Google Kubernetes Engine (GKE)
PDF
Cloud Monitoring with Prometheus
Prometheus design and philosophy
Monitoring using Prometheus and Grafana
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
Prometheus – a next-gen Monitoring System
Prometheus and Grafana
Monitoring With Prometheus
Monitoring With Prometheus
Getting Started Monitoring with Prometheus and Grafana
Apache Airflow
How I learned to time travel, or, data pipelining and scheduling with Airflow
Β 
Monitoring Kubernetes with Prometheus
Prometheus monitoring
An Introduction to Prometheus (GrafanaCon 2016)
Explore your prometheus data in grafana - Promcon 2018
Comprehensive Terraform Training
Prometheus (Prometheus London, 2016)
Prometheus in Practice: High Availability with Thanos (DevOpsDays Edinburgh 2...
[μ˜€ν”ˆμ†ŒμŠ€μ»¨μ„€νŒ…] μΏ λ²„λ„€ν‹°μŠ€μ™€ μΏ λ²„λ„€ν‹°μŠ€ on μ˜€ν”ˆμŠ€νƒ 비ꡐ 및 ꡬ좕 방법
Kubernetes & Google Kubernetes Engine (GKE)
Cloud Monitoring with Prometheus
Ad

Viewers also liked (20)

PDF
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
PDF
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
PDF
Prometheus (Microsoft, 2016)
PDF
Microservices and Prometheus (Microservices NYC 2016)
PPTX
Monitoring What Matters: The Prometheus Approach to Whitebox Monitoring (Berl...
PDF
Daniel Steigerwald - Este.js - konec velkΓ©ho Schizma
PDF
Ansible at FOSDEM (Ansible Dublin, 2016)
PPTX
An Exploration of the Formal Properties of PromQL
PPTX
Prometheus - Open Source Forum Japan
PPTX
So You Want to Write an Exporter
PDF
Monitoring Hadoop with Prometheus (Hadoop User Group Ireland, December 2015)
PPTX
What does "monitoring" mean? (FOSDEM 2017)
PPTX
Provisioning and Capacity Planning (Travel Meets Big Data)
PDF
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
PDF
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
PPTX
Docker cluster with swarm, consul, registrator and consul-template
PDF
Processing Kafka Topics for Monitoring with Prometheus
PDF
Cassandra Day Atlanta 2016 - Monitoring Cassandra
PPTX
Monitoring in a scalable world
PDF
Prometheus lightning talk (Devops Dublin March 2015)
Prometheus: A Next Generation Monitoring System (FOSDEM 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Prometheus (Microsoft, 2016)
Microservices and Prometheus (Microservices NYC 2016)
Monitoring What Matters: The Prometheus Approach to Whitebox Monitoring (Berl...
Daniel Steigerwald - Este.js - konec velkΓ©ho Schizma
Ansible at FOSDEM (Ansible Dublin, 2016)
An Exploration of the Formal Properties of PromQL
Prometheus - Open Source Forum Japan
So You Want to Write an Exporter
Monitoring Hadoop with Prometheus (Hadoop User Group Ireland, December 2015)
What does "monitoring" mean? (FOSDEM 2017)
Provisioning and Capacity Planning (Travel Meets Big Data)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Docker cluster with swarm, consul, registrator and consul-template
Processing Kafka Topics for Monitoring with Prometheus
Cassandra Day Atlanta 2016 - Monitoring Cassandra
Monitoring in a scalable world
Prometheus lightning talk (Devops Dublin March 2015)
Ad

Similar to Prometheus and Docker (Docker Galway, November 2015) (20)

PPTX
Prometheus for Monitoring Metrics (Fermilab 2018)
PDF
System monitoring
PDF
From nothing to Prometheus : one year after
ODP
BP101 - 10 Things to Consider when Developing & Deploying Applications in Lar...
PDF
Cloud Native Development
PPTX
DockerCon Europe 2018 Monitoring & Logging Workshop
PDF
Cloud Monitoring tool Grafana
PDF
Monitoring in Big Data Platform - Albert Lewandowski, GetInData
PDF
Docker Monitoring Webinar
PDF
Introduction to PaaS and Heroku
PDF
IRJET- Real Time Monitoring of Servers with Prometheus and Grafana for High A...
PDF
DevOps Braga #15: Agentless monitoring with icinga and prometheus
PDF
PaaSTA: Autoscaling at Yelp
PDF
Devops with Python by Yaniv Cohen DevopShift
PPTX
Copy of Silk performer - KT.pptx
ODP
Zero Downtime JEE Architectures
PDF
OSMC 2024 | Building a better check_http by Mattias Schlenker.pdf
PPTX
Dev ops for big data cluster management tools
PDF
202107 - Orion introduction - COSCUP
PPTX
Prometheus for Monitoring Metrics (Percona Live Europe 2017)
Prometheus for Monitoring Metrics (Fermilab 2018)
System monitoring
From nothing to Prometheus : one year after
BP101 - 10 Things to Consider when Developing & Deploying Applications in Lar...
Cloud Native Development
DockerCon Europe 2018 Monitoring & Logging Workshop
Cloud Monitoring tool Grafana
Monitoring in Big Data Platform - Albert Lewandowski, GetInData
Docker Monitoring Webinar
Introduction to PaaS and Heroku
IRJET- Real Time Monitoring of Servers with Prometheus and Grafana for High A...
DevOps Braga #15: Agentless monitoring with icinga and prometheus
PaaSTA: Autoscaling at Yelp
Devops with Python by Yaniv Cohen DevopShift
Copy of Silk performer - KT.pptx
Zero Downtime JEE Architectures
OSMC 2024 | Building a better check_http by Mattias Schlenker.pdf
Dev ops for big data cluster management tools
202107 - Orion introduction - COSCUP
Prometheus for Monitoring Metrics (Percona Live Europe 2017)

More from Brian Brazil (12)

PPTX
OpenMetrics: What Does It Mean for You (PromCon 2019, Munich)
PPTX
Evolution of Monitoring and Prometheus (Dublin 2018)
PPTX
Evaluating Prometheus Knowledge in Interviews (PromCon 2018)
PPTX
Anatomy of a Prometheus Client Library (PromCon 2018)
PPTX
Evolving Prometheus for the Cloud Native World (FOSDEM 2018)
PPTX
Evolution of the Prometheus TSDB (Percona Live Europe 2017)
PPTX
Staleness and Isolation in Prometheus 2.0 (PromCon 2017)
PPTX
Rule 110 for Prometheus (PromCon 2017)
PPTX
Counting with Prometheus (CloudNativeCon+Kubecon Europe 2017)
PPTX
Prometheus: From Berlin to Bonanza (Keynote CloudNativeCon+Kubecon Europe 2017)
PPTX
Life of a Label (PromCon2016, Berlin)
PPTX
Prometheus (Monitorama 2016)
OpenMetrics: What Does It Mean for You (PromCon 2019, Munich)
Evolution of Monitoring and Prometheus (Dublin 2018)
Evaluating Prometheus Knowledge in Interviews (PromCon 2018)
Anatomy of a Prometheus Client Library (PromCon 2018)
Evolving Prometheus for the Cloud Native World (FOSDEM 2018)
Evolution of the Prometheus TSDB (Percona Live Europe 2017)
Staleness and Isolation in Prometheus 2.0 (PromCon 2017)
Rule 110 for Prometheus (PromCon 2017)
Counting with Prometheus (CloudNativeCon+Kubecon Europe 2017)
Prometheus: From Berlin to Bonanza (Keynote CloudNativeCon+Kubecon Europe 2017)
Life of a Label (PromCon2016, Berlin)
Prometheus (Monitorama 2016)

Recently uploaded (20)

PPTX
Introuction about WHO-FIC in ICD-10.pptx
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PPTX
artificial intelligence overview of it and more
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPT
tcp ip networks nd ip layering assotred slides
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Internet___Basics___Styled_ presentation
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
Β 
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PPTX
Introduction to Information and Communication Technology
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
Introuction about WHO-FIC in ICD-10.pptx
INTERNET------BASICS-------UPDATED PPT PRESENTATION
QR Codes Qr codecodecodecodecocodedecodecode
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
An introduction to the IFRS (ISSB) Stndards.pdf
Tenda Login Guide: Access Your Router in 5 Easy Steps
Introuction about ICD -10 and ICD-11 PPT.pptx
artificial intelligence overview of it and more
The New Creative Director: How AI Tools for Social Media Content Creation Are...
tcp ip networks nd ip layering assotred slides
international classification of diseases ICD-10 review PPT.pptx
Internet___Basics___Styled_ presentation
Triggering QUIC, presented by Geoff Huston at IETF 123
Β 
Module 1 - Cyber Law and Ethics 101.pptx
Introduction to Information and Communication Technology
Cloud-Scale Log Monitoring _ Datadog.pdf
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
presentation_pfe-universite-molay-seltan.pptx
SASE Traffic Flow - ZTNA Connector-1.pdf

Prometheus and Docker (Docker Galway, November 2015)

  • 1. Prometheus and Docker Monitoring and Management Brian Brazil Founder
  • 2. Who am I? Engineer passionate about running software reliably in production. ● TCD CS Degree ● Google SRE for 7 years, working on high-scale reliable systems such as Adwords, Adsense, Ad Exchange, Billing, Database ● Boxever TL Systems&Infrastructure, applied processes and technology to let allow company to scale and reduce operational load ● Contributor to many open source projects, including Prometheus, Ansible, Python, Aurora and Zookeeper. ● Founder of Robust Perception, making scalability and efficiency available to everyone
  • 3. Why monitor? ● Know when things go wrong β—‹ To call in a human to prevent a business-level issue, or prevent an issue in advance ● Be able to debug and gain insight ● Trending to see changes over time, and drive technical/business decisions ● To feed into other systems/processes (e.g. QA, security, automation)
  • 4. Common Monitoring Challenges Themes common among companies I’ve talk to: ● Monitoring tools are limited, both technically and conceptually ● Tools don’t scale well and are unwieldy to manage ● Operational practices don’t align with the business For example: Your customers care about increased latency and it’s in your SLAs. You can only alert on individual machine CPU usage. Result: Engineers continuously woken up for non-issues, get fatigued
  • 5. Fundamental Challenge is Limited Visibility
  • 6. Prometheus Inspired by Google’s Borgmon monitoring system. Started in 2012 by ex-Googlers working in Soundcloud as an open source project, mainly written in Go. Publically launched in early 2015, and continues to be independent of any one company. Over 100 companies have started relying on it since then.
  • 7. What does Prometheus offer? ● Inclusive Monitoring ● Manageable and Reliable ● Easy to integrate with ● Dashboards ● Powerful data model ● Powerful query language ● Efficient ● Scalable
  • 10. Monitor as a Service, not as Machines
  • 11. Inclusive Monitoring Don’t monitor just at the edges: ● Instrument client libraries ● Instrument server libraries (e.g. HTTP/RPC) ● Instrument business logic Library authors get information about usage. Application developers get monitoring of common components for free. Dashboards and alerting can be provided out of the box, customised for your organisation!
  • 12. Python Instrumentation Example pip install prometheus_client from prometheus_client import Summary, start_http_server REQUEST_DURATION = Summary('request_duration_seconds', 'Request duration in seconds') @REQUEST_DURATION.time() def my_handler(request): pass # Your code here start_http_server(8000)
  • 13. Manageable and Reliable Core Prometheus server is a single binary. Doesn’t depend on Zookeeper, Consul, Cassandra, Hadoop or the Internet. Only requires local disk (SSD recommended). No potential for cascading failure. Pull based, so easy to on run a workstation for testing and rogue servers can’t push bad metrics. Advanced service discovery finds what to monitor.
  • 14. Running Prometheus with Docker Docker images at https://hub.docker.com/r/prom/ To run Prometheus: docker run -p 9090:9090 prom/prometheus:latest This monitors itself. http://localhost:9090/consoles/prometheus.html has a console.
  • 15. Easy to integrate with Many existing integrations: Java, JMX, Python, Go, Ruby, .Net, Machine, Cloudwatch, EC2, MySQL, PostgreSQL, Haskell, Bash, Node.js, SNMP, Consul, HAProxy, Mesos, Bind, CouchDB, Django, Mtail, Heka, Memcached, RabbitMQ, Redis, RethinkDB, Rsyslog, Meteor.js, Minecraft... Graphite, Statsd, Collectd, Scollector, Munin, Nagios integrations aid transition. It’s so easy, most of the above were written without the core team even knowing about them!
  • 16. Cadvisor natively supports Prometheus Run Cadvisor: docker run -v /var/run/:/var/run -v /sys:/sys -p 8080:8080 google/cadvisor http://localhost:8080/metrics will have metrics for all your containers
  • 17. Service Discovery It’s vital to know where each of your instances is meant to be running. Systems such as Docker Swarm spread applications across machines, so we need some form of service discovery to find them. Both Swarm and Prometheus support Consul, so let’s try that.
  • 18. Setting up Swarm on localhost (1) MY_IP=1.2.3.4 # - Run consul docker run -d --name=consul --net=host gliderlabs/consul-server -bootstrap # - Pass the docker daemon -H tcp://0.0.0.0:2375 so it’ll do TCP # - Register services in Consul docker run -d --net=host -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator consul://localhost:8500 # - Join the swarm docker run -d swarm join --addr=$MY_IP:2375 consul://$MY_IP:8500/swarm
  • 19. Setting up Swarm on localhost (2) # - Run some machine monitoring docker run -d -v /var/run/:/var/run -v /sys:/sys -p 8080:8080 google/cadvisor docker run -d -v /:/rootfs:ro -p 9100:9100 --net=host -e SERVICE_NAME=node prom/node-exporter # - Start the Swarm Manager docker run -d -p 2376:2375 swarm manage consul://$MY_IP:8500/swarm # - Check it’s working docker -H tcp://127.0.0.1:2376 info
  • 20. Prometheus configuration to use Consul scrape_configs: - job_name: 'consul' consul_sd_configs: - server: 127.0.0.1:8500 relabel_configs: - source_labels: [__meta_consul_service] regex: (.*) # Default next release replacement: $1 # Default next release target_label: job
  • 21. Run Prometheus docker run -d --net=host -p 9090:9090 -e SERVICE_NAME=prometheus robustperception/prometheus_local_consul Visit http://localhost:9090/status to see it running
  • 24. Many Dashboarding Options ● Grafana β—‹ Latest release has full Prometheus support ● Promdash β—‹ Prometheus-specific Ruby-on-Rails dashboarding solution β—‹ Direction is moving towards Grafana instead ● Console templates β—‹ Templating language inside Prometheus β—‹ Good for having your dashboards checked in, and for fully-custom dashboards ● Expression Browser β—‹ Included in Prometheus, good for ad-hoc debugging ● Roll your own β—‹ JSON API
  • 25. Powerful Data Model All metrics have arbitrary multi-dimensional labels. No need to force your model into dotted strings. Can aggregate, cut, and slice along them. Supports any double value, labels support full unicode.
  • 26. Example: Labels from Node Exporter
  • 27. Powerful Query Language Can multiply, add, aggregate, join, predict, take quantiles across many metrics in the same query. Can evaluate right now, and graph back in time. Answer questions like: ● What’s the 95th percentile latency in the European datacenter? ● How full will the disks be in 4 hours? ● Which services are the top 5 users of CPU? Can alert based on any query.
  • 28. Example: Top 5 Docker images by CPU topk(5, sum by (image)( rate(container_cpu_usage_seconds_total{ id=~"/system.slice/docker.*"}[5m] ) ) )
  • 29. Efficient Instrumenting everything means a lot of data. Prometheus is best in class for lossless storage efficiency, 3.5 bytes per datapoint. A single server can handle: ● millions of metrics ● hundreds of thousands of datapoints per second
  • 30. Scalable Prometheus is easy to run, can give one to each team in each datacenter. Federation allows pulling key metrics from other Prometheus servers. When one job is too big for a single Prometheus server, can use sharding+federation to scale out. Needed with thousands of machines.
  • 31. Final Thought: Instrument Once, Use Everywhere When an application is instrumented, tends to be limited in which monitoring systems it supports. You’re left with a choice: Have N monitoring systems, or run extra services to act as shims to translate. Prometheus clients aren’t just limited to outputting metrics in the Prometheus format, can also output to Graphite and other monitoring systems. Prometheus clients can also take in metrics from other monitoring systems. Prometheus clients can be your instrumentation and metrics interchange, even when not using Prometheus itself!
  • 32. What do we do? Robust Perception provides consulting and training to give you confidence in your production service's ability to run efficiently and scale with your business. We can help you: ● Decide if Prometheus is for you ● Manage your transition to Prometheus and resolve issues that arise ● With capacity planning, debugging, infrastructure etc. We are proud to be among the core contributors to the Prometheus project.
  • 33. Resources Official Project Website: prometheus.io Official Mailing List: prometheus-developers@googlegroups.com Demo: demo.robustperception.io Dockerfiles: https://github.com/RobustPerception/docker_examples Robust Perception Website: www.robustperception.io Queries: prometheus@robustperception.io