46
Monitoring (with) Puppet Monitoring (with) Puppet PuppetCamp Dusseldorf @KrisBuytaert

Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Embed Size (px)

DESCRIPTION

"Monitoring (with) Puppet "(Beginner) by Kris Buytaert, Inuits given at Puppet Camp Düsseldorf 2014

Citation preview

Page 1: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Monitoring (with) PuppetMonitoring (with) Puppet

PuppetCamp Dusseldorf

@KrisBuytaert

Page 2: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

KrisKris BuytaertBuytaert● I used to be a Dev,I used to be a Dev,● Then Became an OpThen Became an Op● Chief Trolling Offcer and Open Source Consultant Chief Trolling Offcer and Open Source Consultant

@[email protected]● Everything is an effng DNS ProblemEverything is an effng DNS Problem● Building Clouds since before the bookstoreBuilding Clouds since before the bookstore● Organising too many confs , #devopsdays, Organising too many confs , #devopsdays,

#loadays, ... #loadays, ... ● Evangelizing devopsEvangelizing devops

Page 3: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Do you know what your children do at 5 am in the Do you know what your children do at 5 am in the morning ?morning ?

● Sleeping ?Sleeping ?

● Crashing a Party ?Crashing a Party ?

● Why are the cops at your front door ?Why are the cops at your front door ?

● What happened ?What happened ?

● How long have they been gone ?How long have they been gone ?

Page 4: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

devops = clamsdevops = clams● CultureCulture

● (Lean)(Lean)

● Automate all the things ... Automate all the things ...

• Build Automation Build Automation

• Test Automation Test Automation

• IACIAC

● Monitoring , Metrics ... Monitoring , Metrics ...

● SharingSharing

Page 5: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Monitoring is usually an aftertoughtMonitoring is usually an aftertoughtENOBUDGET, ENOTIMEENOBUDGET, ENOTIME

Page 6: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

#monitoringsucks#monitoringsucks● John Vincent (@lusis)John Vincent (@lusis)

● A sub movement A sub movement

● https://github.com/monitoringsucks/https://github.com/monitoringsucks/

Page 7: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

#monitoringlove#monitoringlove• #monitoringlove hacksessions#monitoringlove hacksessions

• #monitorama#monitorama

Page 8: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

For years we've tolerated humans to to For years we've tolerated humans to to make structural manual changes to the make structural manual changes to the infrastructure our critical applications are infrastructure our critical applications are running on.running on.

Whilst at the same time demanding those Whilst at the same time demanding those critical applications to go trough rigid test critical applications to go trough rigid test

scenarios.scenarios.

Who let this happen ?Who let this happen ?

Page 9: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Infrastructure as CodeInfrastructure as Code● Model our infrastructure Model our infrastructure

● A fast reproducable platformA fast reproducable platform

● Disaster discovery for “free”Disaster discovery for “free”

Page 10: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Infrastructure as CodeInfrastructure as Code● Code = Code Code = Code

● Version Control Version Control

● Quality ChecksQuality Checks

● TestingTesting

● Continuous IntegrationContinuous Integration

● Continous DeliveryContinous Delivery

Page 11: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Infrastructure as CodeInfrastructure as Code● Core Infrastructure Core Infrastructure

● Middleware deployment and integrationMiddleware deployment and integration

● Automated continuous application Automated continuous application deploymentdeployment

● Integrated Security enforcementIntegrated Security enforcement

● Host, Service and Application Monitoring Host, Service and Application Monitoring confguredconfgured

Page 12: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Why #monitoringsucksWhy #monitoringsucks● Manual confg (gui)Manual confg (gui)

● Not in sync with realityNot in sync with reality

● Hosts onlyHosts only

● Services sometimesServices sometimes

● Appliccation neverAppliccation never

● ChaosChaos

Page 13: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

• Really ?Really ?

• Service,Service,

• FunctionalitiesFunctionalities

• eg. vhosts etceg. vhosts etc

• Single Source of TruthSingle Source of Truth

But tools do AutodetectionBut tools do Autodetection

Page 14: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Monitoring 101Monitoring 101● Deploy a host,Deploy a host,

● Add it to the monitoringAdd it to the monitoring

● Add collection toolsAdd collection tools

● Add check defnitionsAdd check defnitions

● Update the monitoring tool confgUpdate the monitoring tool confg

● RestartRestart

Page 15: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Collect Metrics 101Collect Metrics 101

Page 16: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

CollectdCollectd● CollectsCollects

● Zillion PluginsZillion Plugins

• Nginx,apache, mysql, diskNginx,apache, mysql, disk

● Graphite Carbon PluginGraphite Carbon Plugin

● Send metrics to graphiteSend metrics to graphite

● https://github.com/KrisBuytaert/puppet-https://github.com/KrisBuytaert/puppet-collectdcollectd

Page 17: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Puppet and GraphitePuppet and Graphite● https://github.com/KrisBuytaert/vagrant-graphite/https://github.com/KrisBuytaert/vagrant-graphite/

● Includes Graphite / Gdash / Jmxtrans / Logster / Collectd / Statsd / Includes Graphite / Gdash / Jmxtrans / Logster / Collectd / Statsd / Tattle and more modules as submodules ! Tattle and more modules as submodules !

● git clonegit clone

● git submodule init git submodule init

● git submodule update git submodule update

● vagrant up vagrant up

Page 18: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

2014 style dashboards2014 style dashboards

Page 19: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Alerting 101Alerting 101

Page 20: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Alert all the thingsAlert all the thingsAnd get alertfatigueAnd get alertfatigue

● We are in Germany, EuropeWe are in Germany, Europe

● It needs to be confgurable It needs to be confgurable

=> Icinga=> Icinga

Page 21: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

But Monitoring confg is Data ?But Monitoring confg is Data ?● If it can be generated it's not user If it can be generated it's not user

generated content anymoregenerated content anymore

● Your computer can generate your confg !Your computer can generate your confg !

Page 22: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Stored ConfgsStored Confgs

Page 23: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Collection and ExportCollection and Export

Export :Export :

@@resource { @@resource {

... }... }

Collect:Collect:

Resource <<| query Resource <<| query |>>|>>

Clean out nodes that dissapearClean out nodes that dissapear

puppet node clean puppet node clean

Page 24: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Exporting and Collecting Exporting and Collecting

Page 25: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Default Puppet TypesDefault Puppet Types

Page 26: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Puppet-icinga modulePuppet-icinga module● https://github.com/inuits/puppet-icingahttps://github.com/inuits/puppet-icinga

Page 27: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Monitoring a VhostMonitoring a Vhost

Page 28: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Alternative ApproachesAlternative Approaches

● https://gist.github.com/jfryman/5808537https://gist.github.com/jfryman/5808537

● https://github.com/favoretti/puppetdb-https://github.com/favoretti/puppetdb-external-naginatorexternal-naginator

Page 29: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

● Deploy a new appDeploy a new app

● Add monitoringAdd monitoring

● Add Real application monitoringAdd Real application monitoring

● Both on infra and on app levelBoth on infra and on app level

Page 30: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Monitoring Puppet & FriendsMonitoring Puppet & Friends

Page 31: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Puppet RunsPuppet Runs

Page 32: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

PuppetMasterPuppetMaster

Page 33: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

PuppetMasterPuppetMaster @@nagios_service{"check_socket_8140_puppet_${::fqdn}":@@nagios_service{"check_socket_8140_puppet_${::fqdn}":

check_command => 'check_tcp!8140',check_command => 'check_tcp!8140',

service_description => 'TCP puppet on port 8140',service_description => 'TCP puppet on port 8140',

host_name => $::fqdn,host_name => $::fqdn,

use => 'generic-service',use => 'generic-service',

contact_groups => $::environment,contact_groups => $::environment,

notifcation_period => $::icinga::notifcation_period,notifcation_period => $::icinga::notifcation_period,

notifcations_enabled => $::icinga::notifcations_enabled,notifcations_enabled => $::icinga::notifcations_enabled,

target => "/etc/icinga/objects/services/${::fqdn}.cfg",target => "/etc/icinga/objects/services/${::fqdn}.cfg",

}}

Page 34: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

PuppetDBPuppetDB

Page 35: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

PuppetDB(2)PuppetDB(2)● check_puppetdb_memorycheck_puppetdb_memory

• Java heap memoryJava heap memory

● check_puppetdb_processedcheck_puppetdb_processed

• Nr of reports processedNr of reports processed

● check_puppetdb_populationscheck_puppetdb_populations

• Resources, nodes, resources per nodeResources, nodes, resources per node

● check_puppetdb_queuecheck_puppetdb_queue

• Is pgsql down ? :)Is pgsql down ? :)

Page 36: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Puppet DashboardPuppet Dashboard @@nagios_service{"check_http_puppet_dashboard_${::fqdn}":@@nagios_service{"check_http_puppet_dashboard_${::fqdn}":

check_command => "check_http!-H ${::fqdn} -p 3000 -e 200",check_command => "check_http!-H ${::fqdn} -p 3000 -e 200",

service_description => 'HTTP PuppetDashboard on port 3000',service_description => 'HTTP PuppetDashboard on port 3000',

host_name => $::fqdn,host_name => $::fqdn,

use => 'generic-service',use => 'generic-service',

contact_groups => $::environment,contact_groups => $::environment,

notifcation_period => $::icinga::notifcation_period,notifcation_period => $::icinga::notifcation_period,

notifcations_enabled => $::icinga::notifcations_enabled,notifcations_enabled => $::icinga::notifcations_enabled,

target => "/etc/icinga/objects/services/${::fqdn}.cfg",target => "/etc/icinga/objects/services/${::fqdn}.cfg",

}}

Page 37: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Puppet Dashboard(2)Puppet Dashboard(2)

/usr/share/puppet-dashboard/spool/usr/share/puppet-dashboard/spool

Page 38: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

#MonitoringSucks#MonitoringSucks● Puppetruns break our Icinga boxenPuppetruns break our Icinga boxen

● BadlyBadly

● FrequentlyFrequently

Page 39: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

It ain't borkenIt ain't borken● Successful puppet runSuccessful puppet run

● Successful Icinga reconfgureSuccessful Icinga reconfgure

● Disk usage growsDisk usage grows

● FastFast

Page 40: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Be aware of bucketsBe aware of buckets

Page 41: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

A Puppet BugA Puppet Bug

Page 42: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Triggers on GraphsTriggers on Graphs● Export Java MetricsExport Java Metrics

● JMXTransJMXTrans

● Export JMXConfgsExport JMXConfgs

● Confgure NRPE CheckConfgure NRPE Check

● Export NagiosCheckExport NagiosCheck

● Collect JMX Exports on Collect JMX Exports on JMXTransNodeJMXTransNode

● Graph EmGraph Em

Collect Nagios Confgs on Collect Nagios Confgs on Nagios ServerNagios Server

Page 43: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Triggers on GraphsTriggers on Graphs

Page 44: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

Triggers on GraphsTriggers on Graphs

Page 45: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

SummarySummary● Honour your parentsHonour your parents

● Don't manually do what machines can do Don't manually do what machines can do for youfor you

● Monitor your puppet infrastructure too !Monitor your puppet infrastructure too !

● Send Pull RequestsSend Pull Requests

● Icinga2 module in the worksIcinga2 module in the works

Page 46: Puppet Camp Düsseldorf 2014: Monitoring with Puppet (Beginner)

[email protected]@inuits.eu

Further ReadingFurther Reading@krisbuytaert @krisbuytaert http://www.krisbuytaert.be/blog/http://www.krisbuytaert.be/blog/http://www.inuits.eu/http://www.inuits.eu/

InuitsInuits

Duboistraat 50Duboistraat 502060 Antwerpen2060 AntwerpenBelgiumBelgium891.514.231891.514.231

+32 475 961221+32 475 961221