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

Monitoring in motion

Monitoring in motion

Challenges in monitoring Kubernetes, containers and dynamic infrastructure.

Haïssam Kaj

November 16, 2017
Tweet

Other Decks in Technology

Transcript

  1. • SaaS based infrastructure and app monitoring • Open Source

    Agent • Time series data (metrics and events) and traces • Processing trillions of data points per day • Intelligent Alerting • We’re hiring! (www.datadoghq.com/careers/) Datadog Overview
  2. Outline 1. Intro: The Importance of Monitoring 2. The Challenge:

    Monitoring Dynamic Infrastructure 3. Finding the Signal: How do we know what to monitor? 4. Wrapping up: Applying this to a Go app on Kubernetes
  3. How much we measure? 1 instance • 10 metrics from

    cloud providers 1 operating system (e.g., Linux) • 100 metrics 50~ metrics per application
  4. How much we measure? 1 instance • 10 metrics from

    cloud providers 1 operating system (e.g., Linux) • 100 metrics 50~ metrics per application
 N containers • 150*N metrics
  5. How much we measure? 1 instance • 10 metrics from

    cloud providers 1 operating system (e.g., Linux) • 100 metrics 50~ metrics per application
 N containers • 150*N metrics Metrics Overload!
  6. Open Questions • Where is my container running? • What

    is the capacity of my cluster? • What port is my app running on? • What’s the total throughput of my app? • What’s its response time per tag? (app, version, region) • What’s the distribution of 5xx error per container?
  7. Query Based Monitoring “What’s the average throughput of application:nginx per

    version ?” “Alert me when one of my pod from deployment:foo is not behaving like the others?” “Show me rate of HTTP 500 responses from nginx” “… across all data centers” “… running my app version 2….”
  8. Resource Metrics Utilization: • CPU (user + system) • memory

    • i/o • network traffic Saturation • throttling • swap Error • Network Errors 
 (receive vs transmit)
  9. Docker & Kubernetes Events • Starting / Stopping Containers •

    Scaling Events for Underlying Instances • Deploying a new container build
  10. STATS Command # Usage: docker stats CONTAINER [CONTAINER...] $ docker

    stats $CONTAINER_ID CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O BLOCK I/O ecb37227ac84 0.12% 71.53 MiB/490 MiB 14.60% 900.2 MB/275.5 MB 266.8 MB/872.7 MB
  11. Docker API • Detailed streaming metrics as JSON HTTP socket


    $ curl -v --unix-socket /var/run/docker.sock http://localhost/containers/ 28d7a95f468e/stats

  12. Pseudo-files • Provide visibility into container metrics via the file

    system. • Generally under: 
 /sys/fs/cgroup/<resource>/docker/$CONTAINER_ID/

  13. Pseudo-files: CPU Metrics $ cat /sys/fs/cgroup/cpuacct/docker/$CONTAINER_ID/cpuacct.stat > user 2451 #

    time spent running processes since boot > system 966 # time spent executing system calls since boot $ cat /sys/fs/cgroup/cpu/docker/$CONTAINER_ID/cpu.stat > nr_periods 565 # Number of enforcement intervals that have elapsed > nr_throttled 559 # Number of times the group has been throttled > throttled_time 12119585961 # Total time that members of the group were throttled (12.12 seconds) Pseudo-files: CPU Throttling
  14. metrics - cluster • Generates metrics about the state of

    Kubernetes objects (nodes, pods, services, jobs…) • Network, disk stats • Leader status • Work metrics (consensus proposals, wal sync…) apiserver(s) • status check • resource metrics
  15. LAST SEEN NAME KIND REASON SOURCE MESSAGE 22m dd-agent-2pml8.14f45a4ece3aeca4 Pod

    Killing kubelet, gke-haissam-dl13 Killing container with id dd-agent:Need to kill Pod 21m dd-agent-482vl.14f45a5618aea4c0 Pod SuccessfulMountVolume kubelet, gke-haissam-wnvn MountVolume.SetUp succeeded for volume "cgroups" 21m dd-agent-482vl.14f45a5632a1e86d Pod Pulling kubelet, gke-haissam-wnvn pulling image "datadog/docker-dd-agent:latest" 21m dd-agent-482vl.14f45a5649590c91 Pod Created kubelet, gke-haissam-wnvn Created container 21m dd-agent-482vl.14f45a5650fb2dfd Pod Started kubelet, gke-haissam-wnvn Started container 22m dd-agent.14f45a4ea0acb0c0 DaemonSet SuccessfulDelete daemon-set Deleted pod: dd-agent-2pml8 19m nginx-deployment Deployment ScalingReplicaSet deployment-controller Scaled down replica set nginx-569477d6d8 to 0 events
  16. Auto Discovery Docker API Kubernetes Monitoring Agent Container A O

    A O Containers List & Metadata Additional Metadata (Tags, etc) Config Backends Integration Configurations Host Level Metrics
  17. Custom Metrics • Instrument custom applications
 • PUSH • STATSD

    • DogStatsD • PULL • Go Expvar, Prometheus, JMX, …
  18. Monitoring Questions • Where is a given container running? •

    What is the overall capacity of my cluster? • What port(s) are my applications running on? • What’s the total throughput of my application? • What’s its response time per tag? (app, version, data center) • What’s the distribution of 5xx error per container? What about by data center?
  19. Resources Monitoring 101: Alerting 
 https://www.datadoghq.com/blog/monitoring-101-alerting/ Monitoring 101: Collecting the

    Right Data https://www.datadoghq.com/blog/monitoring-101-collecting-data/ Monitoring 101: Investigating performance issues https://www.datadoghq.com/blog/monitoring-101-investigation/
 The Power of Tagged Metrics https://www.datadoghq.com/blog/the-docker-monitoring-problem/ 8 surprising facts about Docker Adoption https://www.datadoghq.com/docker-adoption/ Control groups, part 4: On accounting https://lwn.net/Articles/606004/