Monitoring Docker - pepa.holla.cz · PDF filezabbix/zabbix-server-2.4 This downloads the...

Click here to load reader

  • date post

    31-Dec-2018
  • Category

    Documents

  • view

    218
  • download

    2

Embed Size (px)

Transcript of Monitoring Docker - pepa.holla.cz · PDF filezabbix/zabbix-server-2.4 This downloads the...

MonitoringDocker

TableofContents

MonitoringDocker

Credits

AbouttheAuthor

AbouttheReviewer

www.PacktPub.com

Supportfiles,eBooks,discountoffers,andmore

Whysubscribe?

FreeaccessforPacktaccountholders

Preface

Whatthisbookcovers

Whatyouneedforthisbook

Whothisbookisfor

Conventions

Readerfeedback

Customersupport

Downloadingtheexamplecode

Downloadingthecolorimagesofthisbook

Errata

Piracy

Questions

1.IntroductiontoDockerMonitoring

Pets,Cattle,Chickens,andSnowflakes

Pets

Cattle

Chickens

Snowflakes

Sowhatdoesthisallmean?

Docker

Launchingalocalenvironment

Cloningtheenvironment

Runningavirtualserver

Haltingthevirtualserver

Summary

2.UsingtheBuilt-inTools

Dockerstats

RunningDockerstats

Whatjusthappened?

Whataboutprocesses?

Dockertop

Dockerexec

Summary

3.AdvancedContainerResourceAnalysis

WhatiscAdvisor?

RunningcAdvisorusingacontainer

CompilingcAdvisorfromsource

Collectingmetrics

TheWebinterface

Overview

Processes

CPU

Memory

Network

Filesystem

Viewingcontainerstats

Subcontainers

Driverstatus

Images

Thisisallgreat,whatsthecatch?

Prometheus

LaunchingPrometheus

QueryingPrometheus

Dashboard

Thenextsteps

Alternatives?

Summary

4.ATraditionalApproachtoMonitoringContainers

Zabbix

InstallingZabbix

Usingcontainers

Usingvagrant

Preparingourhostmachine

TheZabbixwebinterface

Dockermetrics

Createcustomgraphs

Comparecontainerstoyourhostmachine

Triggers

Summary

5.QueryingwithSysdig

WhatisSysdig?

InstallingSysdig

UsingSysdig

Thebasics

Capturingdata

Containers

Furtherreading

UsingCsysdig

Summary

6.ExploringThirdPartyOptions

Awordaboutexternallyhostedservices

DeployingDockerinthecloud

WhyuseaSaaSservice?

SysdigCloud

Installingtheagent

Exploringyourcontainers

Summaryandfurtherreading

Datadog

Installingtheagent

Exploringthewebinterface

Summaryandfurtherreading

NewRelic

Installingtheagent

Exploringthewebinterface

Summaryandfurtherreading

Summary

7.CollectingApplicationLogsfromwithintheContainer

Viewingcontainerlogs

ELKStack

Startingthestack

Logspout

Reviewingthelogs

Whataboutproduction?

Lookingatthirdpartyoptions

Summary

8.WhatAretheNextSteps?

Somescenarios

Pets,Cattle,Chickens,andSnowflakes

Pets

Cattle

Chickens

Snowflakes

Scenarioone

Scenariotwo

Scenariothree

Alittlemoreaboutalerting

Chickens

CattleandPets

Sendingalerts

Keepingup

Summary

Index

MonitoringDocker

MonitoringDockerCopyright2015PacktPublishing

Allrightsreserved.Nopartofthisbookmaybereproduced,storedinaretrievalsystem,ortransmittedinanyformorbyanymeans,withoutthepriorwrittenpermissionofthepublisher,exceptinthecaseofbriefquotationsembeddedincriticalarticlesorreviews.

Everyefforthasbeenmadeinthepreparationofthisbooktoensuretheaccuracyoftheinformationpresented.However,theinformationcontainedinthisbookissoldwithoutwarranty,eitherexpressorimplied.Neithertheauthor,norPacktPublishing,anditsdealersanddistributorswillbeheldliableforanydamagescausedorallegedtobecauseddirectlyorindirectlybythisbook.

PacktPublishinghasendeavoredtoprovidetrademarkinformationaboutallofthecompaniesandproductsmentionedinthisbookbytheappropriateuseofcapitals.However,PacktPublishingcannotguaranteetheaccuracyofthisinformation.

Firstpublished:December2015

Productionreference:1041215

PublishedbyPacktPublishingLtd.

LiveryPlace

35LiveryStreet

BirminghamB32PB,UK.

ISBN978-1-78588-275-3

www.packtpub.com

http://www.packtpub.com

CreditsAuthor

RussMcKendrick

Reviewer

MarceloCorreiaPinheiro

CommissioningEditor

VeenaPagare

AcquisitionEditor

RahulNair

ContentDevelopmentEditor

AnishSukumaran

TechnicalEditor

SaurabhMalhotra

CopyEditor

TrishyaHajare

ProjectCoordinator

IzzatContractor

Proofreader

SafisEditing

Indexers

MariammalChettiyar

PriyaSane

ProductionCoordinator

ShantanuN.Zagade

CoverWork

ShantanuN.Zagade

AbouttheAuthorRussMcKendrickisanexperiencedsolutionsarchitectwhohasbeenworkinginITandIT-relatedindustriesforthebetterpartof23years.Duringhiscareer,hehashadvariedresponsibilitiesinanumberofindustries,rangingfromlookingafterentireITinfrastructurestoprovidingfirstline,secondline,andseniorsupportinclientfacing,andinternalteamsforcorporateorganizations.

HeworksalmostexclusivelywithLinux,usingopensourcesystemsandtoolsonvariousplatformsrangingfromdedicatedhardwareandvirtualmachinestopublicclouds.

AbouttheReviewerMarceloCorreiaPinheiroisaBraziliansoftwareengineerfromPortoAlegre.Hestartedtoworkasawebdesignerandprogrammerin2000withASPandPHP,naturallygettingintouchwiththeMicrosoft.NETframeworkandJavarunningrespectivedatabasesofchoiceforwebapplications.Since2003,hehasusedLinuxandUNIX-relatedoperationalsystems,fromSlackwaretoGoboLinux,Archlinux,CentOS,Debian,andtodayOSX,havingsomecontactwithBSDdistributionstoo.HehaslostsomenightscompilingandapplyingpatchestotheLinuxkerneltomakeitsdesktopwork.Sincethebeginning,hehasbeenactingasaproblemsolver,nomatterwhattheprogramminglanguage,database,orplatformisopensourceenthusiast.

Afterafewyears,hedecidedtoliveinSoPaulotoworkwithnewertechnologiessuchasNoSQL,cloudcomputing,andRuby,wherehestartedtoconducttechtalkswiththislanguageinLocaweb.HecreatedsometoolstostandardizedevelopmentusingtoolssuchasvagrantandRubygemssomeoftheseintheirGitHubinLocawebtoensurefastapplicationpackagingandreduceddeploymentrollbacks.In2013,hechangedhiscareertobeafull-stackdeveloperfollowingtheDevOpsmovement.Since2012,hehasattended,asaspeaker,someofthebiggestsoftwareconferencesinBrazilRSonRails,QConSP,TheDevelopersConference,andRubyConfBraziltalkingnotonlyaboutRuby,butalsoaboutsomeofthewell-knownDevOpstoolssuchasTerraform,Packer,Ansible,andDocker.Today,heworksasaDevOpsconsultantintheircompany.

Inhisfreetime,helovesplayingtheguitar,havingsomefunwithcats,traveling,anddrinkingbeer.Hecanbefoundonhisblog(http://salizzar.net),Twitter(https://twitter.com/salizzar),GitHub(https://github.com/salizzar)andLinkedin(https://www.linkedin.com/in/salizzar).

HehasworkedasareviewerforVagrantVirtualDevelopmentEnvironmentCookbook,aPacktPublishingbookwithusefulrecipesusingvagrantwithconfigurationmanagementtoolssuchasPuppet,Chef,Ansible,andSaltStack.

Iwanttothankallmyfriends,whobelievedinmypotentialsincethebeginningandwhostillfollowmedespitethedistance.Iwouldalsoliketothankmymentors,GleiconMoraes,RobertoGaiser,andRodrigoCampos,whogavemetheincentiveandtipstobeabettersoftwareengineerandperson.

http://salizzar.nethttps://twitter.com/salizzarhttps://github.com/salizzarhttps://www.linkedin.com/in/salizzar

www.PacktPub.com

Supportfiles,eBooks,discountoffers,andmoreForsupportfilesanddownloadsrelatedtoyourbook,pleasevisitwww.PacktPub.com.

DidyouknowthatPacktofferseBookversionsofeverybookpublished,withPDFandePubfilesavailable?YoucanupgradetotheeBookversionatwww.PacktPub.comandasaprintbookcustomer,youareentitledtoadiscountontheeBookcopy.Getintouchwithusatformoredetails.

Atwww.PacktPub.com,youcanalsoreadacollectionoffreetechnicalarticles,signupforarangeoffreenewslettersandreceiveexclusivediscountsandoffersonPacktbooksandeBooks.

https://www2.packtpub.com/books/subscription/packtlib

DoyouneedinstantsolutionstoyourITquestions?PacktLibisPacktsonlinedigitalbooklibrary.Here,youcansearch,access,andreadPacktsentirelibraryofbooks.

http://www.PacktPub.comhttp://www.PacktPub.commailto:service@packtpub.comhttp://www.PacktPub.comhttps://www2.packtpub.com/books/subscription/packtlib

Whysubscribe?FullysearchableacrosseverybookpublishedbyPacktCopyandpaste,print,andbookmarkcontentOndemandandaccessibleviaawebbrowser

FreeaccessforPacktaccountholdersIfyouhaveanaccountwithPacktatwww.PacktPub.com,youcanusethistoaccessPacktLibtodayandview9entirelyfreebooks.Simplyuseyourlogincredentialsforimmediateaccess.

http://www.PacktPub.com

PrefaceWiththeincreaseintheadoptionofDockercontainers,theneedtomonitorwhichcontainersarerunning,whatresourcestheyareconsuming,andhowitaffectstheoverallperformanceofthesystem,hasbecomeatime-relatedneed.MonitoringDockerwillteachyouhowmonitoringcontainersandkeepingakeeneyeontheworkingofapplicationshelptoimprovetheoverallperformanceoftheapplicationsthatrunonDocker.

ThisbookwillcovermonitoringcontainersusingDockersnativemonitoringfunctions,variousplugins,andalsothird-partytoolsthathelpinmonitoring.Thebookwillfirstcoverhowtoobtaindetailedstatsfortheactivecontainers,resourcesconsumed,andcontainerbehavior.Thisbookwillalsoshowthereadershowtousethesestatstoimprovetheoverallperformanceofthesystem.

WhatthisbookcoversChapter1,IntroductiontoDockerMonitoring,discusseshowdifferentitistomonitorcontainerscomparedtomoretraditionalserverssuchasvirtualmachines,baremetalmachines,andcloudinstances(PetsversusCattleandChickensversusSnowflakes).Thischapteralsodetailstheoperatingsystemscovered