Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Docker Monitoring

Introduction to Docker Monitoring

Datadog's Docker Monitoring Tutorial from DockerCon 2016. Presented by Matt Williams

Ilan Rabinovitch

June 21, 2016
Tweet

More Decks by Ilan Rabinovitch

Other Decks in Technology

Transcript

  1. Intro / Agenda • Datadog • Monitoring 101 • Docker

    Overview • Build the App Start by cloning the demo repository on github: git clone https://github.com/DataDog/dockercon- 2016-tutorial
  2. Get started with the app 1. Open readme.md at the

    root of the repo 2. Install the Docker Toolbox 3. Create a docker-machine 4. Run the docker pull commands at the bottom of the file
  3. •SaaS based infrastructure and app monitoring •Open Source Agent •Time

    series data (metrics and events) •Processing nearly a trillion data points per day •Intelligent Alerting •We’re hiring! (www.datadoghq.com/careers/) Datadog Overview
  4. Examples: NGINX - Metrics Work Metrics: • Requests Per Second

    Dropped Connections • Request Time • Error Rates (4xx or 5xx) • Success (2xx) Resource Metrics: • Disk I/O • Memory • CPU • Queue Length
  5. Why Use Docker 1. Rapid application deployment 2. Portability across

    machines 3. Version control and component reuse 4. Sharing 5. Lightweight footprint and minimal overhead 6. Simplified maintenance Source: Redhat Documentation
  6. Session Process 1. I will describe high level concepts, talk

    about commands and tools you will use 2. When we get to the slide: Step xx Hands On, it’s your turn a. Go to the folder for the step in the repo you cloned b. Open the readme file, this will be useful if you want to copy/paste commands c. I will be doing the steps on the big screen i. You can either just watch or follow along
  7. Using the Docker commands docker run ... docker ps docker

    logs ... docker stop ... docker rm ...
  8. Overview of Rabbit Message Broker software/ Message Oriented Middleware Implements

    Advanced Message Queuing Protocol (AMQP) https://www.cloudamqp.com/blog/2015-05-18-part1-rabbitmq-for- beginners-what-is-rabbitmq.html
  9. Step 01 Hands On 1. docker run -d --hostname rabbit

    --name rabbit rabbitmq:3 2. docker ps 3. docker logs <container-id> 4. docker stop <container-id> 5. docker run --hostname rabbit --name rabbit rabbitmq:3 6. docker rm <container-id> 7. docker run --hostname rabbit --name rabbit rabbitmq:3-mng
  10. Using docker-compose commands docker-compose files are easier to share and

    easier to link containers docker run is easier to work with single containers docker-compose up docker-compose stop docker-compose rm
  11. Step 03 Hands On 1. Create a Twitter app, set

    the environment vars in your shell for the 4 keys 2. docker-compose up 3. docker-compose -f docker-compose2.yaml up 4. docker-compose -f docker-compose2.yaml build dc2016golangapp
  12. Step 04 - Get Started with Datadog 1) If you

    do not have an account, sign up for free at http://datadog.com 2) Login and find your API key a) Select Integrations->APIs
  13. RabbitMQ Metrics Work Metrics: • total messages in the queue

    • Message Rate (published vs delivered) • Active_consumers • Redeliver Rate • messages_unacknowledged Resource Metrics: • Used file descriptors • Memory used by queue • Disk I/O • Network I/O
  14. Step 04 Hands On 1. Create a Datadog trial account,

    set the API Key as an environment variable 2. docker-compose up 3. docker ps -f “name=_datadog”; docker exec -it <id> bash 4. service datadog-agent info 5. docker exec -it `docker ps -f “name=_datadog” -q` service datadog-agent info 6. docker-compose exec datadog service datadog-agent info 7. docker-compose rm -f; docker-compose up
  15. Logstash overview Collects, processes, and forwards events and log messages

    Part of the ELK (ElasticSearch, Logstash, Kibana) Stack “Provides the ability to filter, massage, and shape the data so that it’s easier to work with” (logz.io tutorial on logstash)
  16. Logstash configuration input { rabbitmq { host => "rabbit" queue

    => "TweetQ" tags => ["test"]}} filter { grok { match => ["message", "^%{TIMESTAMP...REEDYDATA:tweet}"] } }
  17. Step 05 Hands On 1. docker-compose up 2. docker-compose build

    logstash 3. docker images 4. docker-compose -f docker-compose2.yaml up
  18. Elasticsearch overview Elasticsearch is an open-source, broadly-distributable, readily-scalable, enterprise-grade search

    engine. Accessible through an extensive and elaborate API, Elasticsearch can power extremely fast searches that support your data discovery applications. https://qbox.io/blog/what-is-elasticsearch
  19. Instrumenting the app You can instrument the key metrics and

    events from your app in Datadog Go to http://docs.datadoghq.com/libraries/ to see which libraries are available We will use https://github.com/DataDog/datadog-go in this session
  20. Dogstatsd vs API Two choices for sending metrics to Datadog.

    RESTful API or Dogstatsd API sends each metric directly to Datadog Dogstatsd relays it via the Datadog agent
  21. Using the golang lib Create the client - statsd.New(host:8125) Specify

    Namespace and Tags Add a Count - client.Count(name, value, tags, rate) Add a Gauge - client.Gauge(name, value, tags, rate) Add an Event - client.Event(statsd.Event{title, text, time, host, aggkey, priority, source, alert type, tags)