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

Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

  • Upload
    netways

  • View
    114

  • Download
    0

Embed Size (px)

DESCRIPTION

In the age of automated infrastructure our monitoring tools need to be capable of being automated , we need to be able to deploy new services and hosts and know that they are monitored. Puppet can obviously help us here. But in the age of the chaos monkey our puppet infra needs to be monitored too. So how do you monitor Puppet and its friends itselve ? This talk will give you some ideas on monitoring a puppetmaster with it's friends , PuppetDB, etc ..

Citation preview

Page 1: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Monitoring (with) PuppetMonitoring (with) Puppet

PuppetCamp Dusseldorf

@KrisBuytaert

Page 2: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

KrisKris BuytaertBuytaert

● I used to be a Dev,I used to be a Dev,● Then Became an OpThen Became an Op● Chief Trolling Officer and Open Source Chief Trolling Officer and Open Source Consultant @inuits.euConsultant @inuits.eu

● Everything is an effing DNS ProblemEverything is an effing 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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Do you know what your children do at 5 am in Do you know what your children do at 5 am in the morning ?the 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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Monitoring is usually an Monitoring is usually an aftertoughtaftertought

ENOBUDGET, ENOTIMEENOBUDGET, ENOTIME

Page 6: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

#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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

#monitoringlove#monitoringlove• #monitoringlove hacksessions#monitoringlove hacksessions

• #monitorama#monitorama

Page 8: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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 infrastructure our critical applications are running on.applications are running on.

Whilst at the same time demanding Whilst at the same time demanding those critical applications to go those critical applications to go

trough rigid test scenarios.trough rigid test scenarios.

Who let this happen ?Who let this happen ?

Page 9: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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 Host, Service and Application Monitoring configuredMonitoring configured

Page 12: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Why #monitoringsucksWhy #monitoringsucks

● Manual config (gui)Manual config (gui)

● Not in sync with realityNot in sync with reality

● Hosts onlyHosts only

● Services sometimesServices sometimes

● Appliccation neverAppliccation never

● ChaosChaos

Page 13: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

• 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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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 definitionsAdd check definitions

● Update the monitoring tool configUpdate the monitoring tool config

● RestartRestart

Page 15: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Collect Metrics 101Collect Metrics 101

Page 16: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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/puppehttps://github.com/KrisBuytaert/puppet-collectdt-collectd

Page 17: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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

● Includes Graphite / Gdash / Jmxtrans / Logster / Collectd / Includes Graphite / Gdash / Jmxtrans / Logster / Collectd / Statsd / Tattle and more modules as submodules ! Statsd / 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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

2014 style dashboards2014 style dashboards

Page 19: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Alerting 101Alerting 101

Page 20: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Alert all the thingsAlert all the thingsAnd get alertfatigueAnd get alertfatigue

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

● It needs to be configurable It needs to be configurable

=> Icinga=> Icinga

Page 21: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

But Monitoring config is But Monitoring config is Data ?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 Your computer can generate your config !config !

Page 22: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Stored ConfigsStored Configs

Page 23: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Collection and ExportCollection and Export

Export :Export :

@@resource { @@resource {

... }... }

Collect:Collect:

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

Clean out nodes that dissapearClean out nodes that dissapear

puppet node clean puppet node clean

Page 24: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Exporting and Collecting Exporting and Collecting

Page 25: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Default Puppet TypesDefault Puppet Types

Page 26: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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

Page 27: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Monitoring a VhostMonitoring a Vhost

Page 28: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Alternative ApproachesAlternative Approaches

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

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

Page 29: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

● 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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Monitoring Puppet & FriendsMonitoring Puppet & Friends

Page 31: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Puppet RunsPuppet Runs

Page 32: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

PuppetMasterPuppetMaster

Page 33: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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,

notification_period => $::icinga::notification_period,notification_period => $::icinga::notification_period,

notifications_enabled => $::icinga::notifications_enabled,notifications_enabled => $::icinga::notifications_enabled,

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

}}

Page 34: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

PuppetDBPuppetDB

Page 35: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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 Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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,

notification_period => $::icinga::notification_period,notification_period => $::icinga::notification_period,

notifications_enabled => $::icinga::notifications_enabled,notifications_enabled => $::icinga::notifications_enabled,

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

}}

Page 37: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Puppet Dashboard(2)Puppet Dashboard(2)

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

Page 38: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

PuppetServerPuppetServer

Page 39: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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

● BadlyBadly

● FrequentlyFrequently

Page 40: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

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

● Successful Icinga reconfigureSuccessful Icinga reconfigure

● Disk usage growsDisk usage grows

● FastFast

Page 41: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Be aware of bucketsBe aware of buckets

Page 42: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

A Puppet BugA Puppet Bug

Page 43: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Triggers on GraphsTriggers on Graphs● Export Java MetricsExport Java Metrics

● JMXTransJMXTrans

● Export JMXConfigsExport JMXConfigs

● Configure NRPE CheckConfigure NRPE Check

● Export NagiosCheckExport NagiosCheck

● Collect JMX Exports on Collect JMX Exports on JMXTransNodeJMXTransNode

● Graph EmGraph Em

Collect Nagios Configs Collect Nagios Configs on Nagios Serveron Nagios Server

Page 44: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Triggers on GraphsTriggers on Graphs

Page 45: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

Triggers on GraphsTriggers on Graphs

Page 46: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

SummarySummary● Honour your parentsHonour your parents

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

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

● Send Pull RequestsSend Pull Requests

● Icinga2 module in the worksIcinga2 module in the works

Page 47: Puppet Camp Duesseldorf 2014: Kris Buytaert - Monitoring (with) Puppet

[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