SlideShare a Scribd company logo
1 of 55
Download to read offline
The road to lazy monitoringThe road to lazy monitoring
with Icinga2 & Puppetwith Icinga2 & Puppet
Tom De Vylder
@tomdevylder
whoiswhois
● Ops guyOps guy
● Rusty, old, Bavarian vehicles enthousiastRusty, old, Bavarian vehicles enthousiast
● The one who always gets the patdown at checkpointsThe one who always gets the patdown at checkpoints
● Open Source Consultant & Enthousiast at InuitsOpen Source Consultant & Enthousiast at Inuits
● Team Packages & Tools at IcingaTeam Packages & Tools at Icinga
Monitoring!Monitoring!
Monitoring!Monitoring!
Image credits: http://mta.hu/data/cikk/13/00/73/cikk_130073/20120611-144546.jpgImage credits: http://mta.hu/data/cikk/13/00/73/cikk_130073/20120611-144546.jpg
Monitoring :((Monitoring :((
Monitoring is...Monitoring is...
● BoringBoring
● TediousTedious
● RepetitiveRepetitive
● Production =Production = deploymentdeployment + monitoring + backup+ monitoring + backup
● Often neglectedOften neglected
Monitoring is...Monitoring is...
● BoringBoring
● TediousTedious
● RepetitiveRepetitive
● Production =Production = deploymentdeployment + monitoring + backup+ monitoring + backup
● Often neglectedOften neglected
Why can'tWhy can't
someone else do it?someone else do it?
Someone else!Someone else!
● TediousTedious
● RepetitiveRepetitive
● People make mistakesPeople make mistakes
● Nobody likes Nagios configsNobody likes Nagios configs
Someone else!Someone else!
● TediousTedious
● RepetitiveRepetitive
● People make mistakesPeople make mistakes
● Nobody likes Nagios configsNobody likes Nagios configs
● Monitor servers not peopleMonitor servers not people
Image credits: https://openclipart.org/image/2400px/svg_to_png/219371/You-Are-Being-Monitored.pngImage credits: https://openclipart.org/image/2400px/svg_to_png/219371/You-Are-Being-Monitored.png
Single source of truthSingle source of truth
Config management!Config management!
Config management!Config management!
PuppetPuppet RudderRudder
JujuJuju
ChefChef
AnsibleAnsible
SaltstackSaltstack
CFEngineCFEngine
TrueConfigTrueConfig
PuppetPuppet
PuppetPuppet
● Config management toolConfig management tool
● Exported resourcesExported resources
● PuppetDBPuppetDB
● Nagios_* {} resource typesNagios_* {} resource types
node “web.example.org” {
@@nagios_host { $::fqdn:
ensure => present,
alias => $::hostname,
address => $::ipaddress,
use => "generic-host",
}
@@nagios_service { "check_ping_${::fqdn}":
check_command => "check_ping",
use => "generic-service",
host_name => $::fqdn",
notification_period => "24x7",
service_description => "${::fqdn}_check_ping",
}
}
Nagios_* {} resource typesNagios_* {} resource types
node icinga.example.org {
Nagios_host <<||>>
Nagios_service <<||>>
}
Nagios_* {} resource typesNagios_* {} resource types
@@nagios_host { $::fqdn:
ensure => absent,
}
@@nagios_service { "check_ping_${::fqdn}":
ensure => absent,
}
Nagios_* {} resource typesNagios_* {} resource types
Nagios_host <<||>>
Nagios_service <<||>>
Nagios_* {} resource typesNagios_* {} resource types
/etc/nagios/
PuppetPuppet
● Config management toolConfig management tool
● Exported resourcesExported resources
● PuppetDBPuppetDB
● Nagios_* resource typesNagios_* resource types
PuppetPuppet
● Config management toolConfig management tool
● Exported resourcesExported resources
● PuppetDBPuppetDB
● Nagios_* resource typesNagios_* resource types
● https://github.com/Icinga/puppet-icinga2https://github.com/Icinga/puppet-icinga2
● https://github.com/Icinga/puppet-icingaweb2https://github.com/Icinga/puppet-icingaweb2
Puppet-Icinga2Puppet-Icinga2
puppet-icinga2 (develop) ☃ git log | tail -4
Author: Nick Chappell
Date: Fri May 2 19:36:32 2014 -0700
Initial commit.
Other tools...Other tools...
● https://github.com/Icinga/puppet-icinga2https://github.com/Icinga/puppet-icinga2
● https://github.com/Icinga/puppet-icingaweb2https://github.com/Icinga/puppet-icingaweb2
● https://github.com/Icinga/icinga2-ansiblehttps://github.com/Icinga/icinga2-ansible
● https://github.com/Icinga/docker-icinga2https://github.com/Icinga/docker-icinga2
● https://github.com/Icinga/chef-icinga2https://github.com/Icinga/chef-icinga2
Puppet asPuppet as
central source of truthcentral source of truth
Exported resourcesExported resources
Exported resourcesExported resources
Collected resourcesCollected resources
Icinga2Icinga2
Icinga2Icinga2
● ApplyApply rulesrules
● Assign rulesAssign rules
template Service "generic-service" {
max_check_attempts = 3
check_interval = 5min
retry_interval = 5min
enable_perfdata = true
}
apply Service "ping4" {
import "generic-service"
check_command = "ping4"
assign where host.address
}
apply Service "ping6" {
import "generic-service"
check_command = "ping6
assign where host.address6
}
Icinga2Icinga2
apply Service "ssh" {
import "generic-service"
check_command = "ssh"
assign where host.address && host.vars.os == "Linux"
}
Icinga2Icinga2
object HostGroup "database" {
display_name = "Database Servers"
assign where match("mysql*", host.name)
assign where match("psql*", host.name)
assign where match("db*", host.name)
}
Icinga2Icinga2
Icinga2Icinga2
● ApplyApply rulesrules
● Assign rulesAssign rules
● Exported resourcesExported resources
node 'web.example.org' {
@@::icinga2::object::host { $::fqdn:
groups => ['puppet', $::operatingsystem],
target_dir => '/etc/icinga2/objects/hosts',
target_file_name => "${::fqdn}.conf",
template_to_import => 'linux-host',
vars => {
distro => $::operatingsystem,
distro_version => $::operatingsystemrelease,
virtual_machine => $::is_virtual,
puppet_version => $::puppetversion,
puppet_environment => $::environment,
},
}
}
node 'web.example.org' {
@@::icinga2::object::host { $::fqdn:
groups => ['puppet', $::operatingsystem],
target_dir => '/etc/icinga2/objects/hosts',
target_file_name => "${::fqdn}.conf",
template_to_import => 'linux-host',
vars => {
distro => $::operatingsystem,
distro_version => $::operatingsystemrelease,
virtual_machine => $::is_virtual,
puppet_version => $::puppetversion,
puppet_environment => $::environment,
puppet_classes => $::puppet_classes,
puppet_modules => $::puppet_modules,
},
}
}
classes_file = '/var/lib/puppet/classes.txt'
classes_hash = {}
modules_array = []
File.foreach(classes_file) do |l|
modules_array << l.chomp.gsub(/::.*/, '')
end
modules_array = modules_array.sort.uniq
modules_array.each do |i|
classes_array = []
classes_array << i
File.foreach(classes_file) do |l|
classes_array << l.chomp if l =~ /^#{i}/
classes_array = classes_array.sort.uniq
end
classes_hash[i] = classes_array
end
Facter.add(:puppet_modules, :timeout => 10) do
confine :kernel => 'Linux'
setcode do
modules_array.sort.uniq.join(', ').to_s
end
end
Facter.add(:puppet_classes, :timeout => 10) do
confine :kernel => 'Linux'
setcode do
classes_hash.map { |_k, v| v }.sort.uniq.join(', ').to_s
end
end
# facter -p puppet_modules --yaml
---
puppet_modules:
- apache
- collectd
- concat
- dnsclient
- firewall
- grafana
- icinga2
- logrotate
- mysql
- postfix
- ssh
- stdlib
- sudo
- sysctl
- ulimit
# facter -p puppet_classes --yaml
---
puppet_classes:
mysql:
- mysql
- "mysql::client"
- "mysql::client::install"
- "mysql::server"
- "mysql::server::config"
- "mysql::server::install"
- "mysql::server::installdb"
- "mysql::server::service"
icinga2:
- icinga2
- "icinga2::server"
- "icinga2::server::config"
- "icinga2::server::features"
- "icinga2::server::install"
- "icinga2::server::service"
@@::icinga2::object::host { $::fqdn:
groups => ['puppet', $::operatingsystem],
target_dir => '/etc/icinga2/objects/hosts',
target_file_name => "${::fqdn}.conf",
template_to_import => 'linux-host',
vars => {
distro => $::operatingsystem,
distro_version => $::operatingsystemrelease,
virtual_machine => $::is_virtual,
puppet_version => $::puppetversion,
puppet_environment => $::environment,
puppet_classes => inline_template(
'<%= puppet_classes.collect { |k, v| v }.sort.join(" ") %>'
),
puppet_modules => inline_template(
'<%= puppet_modules.sort.join(" ") %>'
),
},
}
icinga2::object::apply_service_to_host { 'mysql_server':
check_command => 'by_ssh',
display_name => 'MySQL',
target_dir => '/etc/icinga2/objects/applys',
assign_where => '"match(*mysql::server*", host.vars.puppet_classes)"',
vars => {
by_ssh_command => "check_tcp -H localhost -p 3306",
by_ssh_logname => 'root',
by_ssh_quiet => true,
by_ssh_timeout => 60,
},
}
Collected resourcesCollected resources
There's a better wayThere's a better way
Query PuppetDBQuery PuppetDB
curl 
-s 
-X GET 
http://puppetdb:8080/pdb/query/v4/resources 
--data-urlencode 
'query=["extract", "certname",
["and",
["=", "type", "Class"],
["~", "title", "^Settings"]
]
]'
Query PuppetDBQuery PuppetDB
PuppetDBqueryPuppetDBquery
$nodes = query_nodes('Class[Settings]', 'fqdn')
PuppetDBqueryPuppetDBquery
$nodes = query_nodes('Class[Settings]', 'fqdn')
notify { "${nodes}": }
# puppet agent --test –noop
Info: Applying configuration version '1447591034'
Notice: /Stage[main]/Main/Notify[web.example.org,
db.example.org, icinga2.example.org,
puppet.example.org]/message: current_value absent,
should be [web.example.org, db.example.org,
icinga2.example.org, puppet.example.org] (noop)
Notice: Applied catalog in 0.21 seconds
PuppetDBqueryPuppetDBquery
$nodes = query_nodes('Class[Mysql::Server]', 'fqdn')
notify { "${nodes}": }
# puppet agent --test –noop
Info: Applying configuration version '1447591391'
Notice:
/Stage[main]/Main/Notify[db.example.org]/message:
current_value absent, should be db.example.org (noop)
Notice: Applied catalog in 0.21 seconds
PuppetDBqueryPuppetDBquery
$nodes = query_nodes('Class[Settings]', 'fqdn')
define monitor::host ($host_name) {
$foo.each |Integer $index, String $host| {
::icinga2::object::host { $host:
groups => ['puppet', $::operatingsystem],
target_dir => '/etc/icinga2/objects/hosts',
target_file_name => "${host}.conf",
template_to_import => 'linux-host',
}
}
}
::monitor::host { 'all':
host_name => $nodes,
}
PuppetDBqueryPuppetDBquery
SummarySummary
● No more exported resourcesNo more exported resources
● Automagically worksAutomagically works
● Production = deployment +Production = deployment + monitoringmonitoring + backup+ backup
● Purge decommissioned nodesPurge decommissioned nodes
ContactContact
Tom De VylderTom De Vylder
@tomdevylder@tomdevylder
tomdv@inuits.eutomdv@inuits.eu
INUITS bvbaINUITS bvba
Heidestraat 257Heidestraat 257
2070 Zwijndrecht2070 Zwijndrecht
BelgiumBelgium
+32 475 961221+32 475 961221
info@inuits.euinfo@inuits.eu

More Related Content

What's hot

Put on Your Asynchronous Hat and Node
Put on Your Asynchronous Hat and NodePut on Your Asynchronous Hat and Node
Put on Your Asynchronous Hat and NodeMarc Fasel
 
Modern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in PerlModern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in PerlNova Patch
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolutionTatiana Al-Chueyr
 
Current State of Python Packaging
Current State of Python PackagingCurrent State of Python Packaging
Current State of Python PackagingClayton Parker
 
Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Takuya Nishimoto
 
Better Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx ExtensionsBetter Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx Extensionsdoughellmann
 
MongoDB - Monitoring & queueing
MongoDB - Monitoring & queueingMongoDB - Monitoring & queueing
MongoDB - Monitoring & queueingBoxed Ice
 

What's hot (8)

Put on Your Asynchronous Hat and Node
Put on Your Asynchronous Hat and NodePut on Your Asynchronous Hat and Node
Put on Your Asynchronous Hat and Node
 
Modern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in PerlModern Getopt for Command Line Processing in Perl
Modern Getopt for Command Line Processing in Perl
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolution
 
Current State of Python Packaging
Current State of Python PackagingCurrent State of Python Packaging
Current State of Python Packaging
 
Great Hiroshima with Python 170830
Great Hiroshima with Python 170830Great Hiroshima with Python 170830
Great Hiroshima with Python 170830
 
Better Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx ExtensionsBetter Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx Extensions
 
R-House (LSRC)
R-House (LSRC)R-House (LSRC)
R-House (LSRC)
 
MongoDB - Monitoring & queueing
MongoDB - Monitoring & queueingMongoDB - Monitoring & queueing
MongoDB - Monitoring & queueing
 

Viewers also liked

International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)inventionjournals
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)inventionjournals
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)inventionjournals
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)inventionjournals
 
A paysanne - artisoo
A paysanne  - artisooA paysanne  - artisoo
A paysanne - artisooparkupton
 
Proquest - Pivot para Pesquisadores, Docentes e Staff
Proquest - Pivot para Pesquisadores, Docentes e StaffProquest - Pivot para Pesquisadores, Docentes e Staff
Proquest - Pivot para Pesquisadores, Docentes e StaffSIBiUSP
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)inventionjournals
 
Individu b.indonesia
Individu b.indonesiaIndividu b.indonesia
Individu b.indonesiaDanang Wijaya
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)inventionjournals
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)inventionjournals
 
Employee relations; focusing on legislations that governs employment relation...
Employee relations; focusing on legislations that governs employment relation...Employee relations; focusing on legislations that governs employment relation...
Employee relations; focusing on legislations that governs employment relation...Judith Kinya
 
Avoid Mistakes in Your Resume
Avoid Mistakes in Your ResumeAvoid Mistakes in Your Resume
Avoid Mistakes in Your ResumeFirm Next
 
Internal Dynamics of Pakistan and its Impact on National Security
Internal Dynamics of Pakistan and its Impact on National SecurityInternal Dynamics of Pakistan and its Impact on National Security
Internal Dynamics of Pakistan and its Impact on National SecurityFarooq Ahmad Butt
 

Viewers also liked (16)

International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)
 
Bei
BeiBei
Bei
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)
 
A paysanne - artisoo
A paysanne  - artisooA paysanne  - artisoo
A paysanne - artisoo
 
Low Soo Peng Incheon University
Low Soo Peng Incheon UniversityLow Soo Peng Incheon University
Low Soo Peng Incheon University
 
Proquest - Pivot para Pesquisadores, Docentes e Staff
Proquest - Pivot para Pesquisadores, Docentes e StaffProquest - Pivot para Pesquisadores, Docentes e Staff
Proquest - Pivot para Pesquisadores, Docentes e Staff
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)
 
Individu b.indonesia
Individu b.indonesiaIndividu b.indonesia
Individu b.indonesia
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)
 
International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)International Journal of Humanities and Social Science Invention (IJHSSI)
International Journal of Humanities and Social Science Invention (IJHSSI)
 
Employee relations; focusing on legislations that governs employment relation...
Employee relations; focusing on legislations that governs employment relation...Employee relations; focusing on legislations that governs employment relation...
Employee relations; focusing on legislations that governs employment relation...
 
Avoid Mistakes in Your Resume
Avoid Mistakes in Your ResumeAvoid Mistakes in Your Resume
Avoid Mistakes in Your Resume
 
Slide Édipo Rei
Slide Édipo ReiSlide Édipo Rei
Slide Édipo Rei
 
Internal Dynamics of Pakistan and its Impact on National Security
Internal Dynamics of Pakistan and its Impact on National SecurityInternal Dynamics of Pakistan and its Impact on National Security
Internal Dynamics of Pakistan and its Impact on National Security
 

Similar to OSMC 2015:The road to lazy monitoring with Icinga 2 and Puppet by Tom de Vylder

How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modulesKris Buytaert
 
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Publicis Sapient Engineering
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-Gründemann
 
Icinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoringIcinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoringOlinData
 
Icinga 2 and Puppet automate monitoring
Icinga 2 and Puppet  automate monitoringIcinga 2 and Puppet  automate monitoring
Icinga 2 and Puppet automate monitoringIcinga
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Ivan Chernoff
 
Automating MySQL operations with Puppet
Automating MySQL operations with PuppetAutomating MySQL operations with Puppet
Automating MySQL operations with PuppetKris Buytaert
 
Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Puppet
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteBram Vogelaar
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetWalter Heck
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetOlinData
 
“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.Graham Dumpleton
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionJoshua Thijssen
 
Virtualenv
VirtualenvVirtualenv
VirtualenvWEBdeBS
 
Deploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab FacilitiesDeploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab FacilitiesFIWARE
 
Python-specific packaging
Python-specific packagingPython-specific packaging
Python-specific packagingdwvisser
 

Similar to OSMC 2015:The road to lazy monitoring with Icinga 2 and Puppet by Tom de Vylder (20)

How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 
Malcon2017
Malcon2017Malcon2017
Malcon2017
 
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
 
Mojolicious lite
Mojolicious liteMojolicious lite
Mojolicious lite
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
Icinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoringIcinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoring
 
Icinga 2 and Puppet automate monitoring
Icinga 2 and Puppet  automate monitoringIcinga 2 and Puppet  automate monitoring
Icinga 2 and Puppet automate monitoring
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!
 
Automating MySQL operations with Puppet
Automating MySQL operations with PuppetAutomating MySQL operations with Puppet
Automating MySQL operations with Puppet
 
Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 
“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.
 
Deploy MediaWiki usgin Fiware Lab Facilities
Deploy MediaWiki usgin Fiware Lab FacilitiesDeploy MediaWiki usgin Fiware Lab Facilities
Deploy MediaWiki usgin Fiware Lab Facilities
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Deploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab FacilitiesDeploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab Facilities
 
Python-specific packaging
Python-specific packagingPython-specific packaging
Python-specific packaging
 

Recently uploaded

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 

Recently uploaded (20)

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 

OSMC 2015:The road to lazy monitoring with Icinga 2 and Puppet by Tom de Vylder

  • 1. The road to lazy monitoringThe road to lazy monitoring with Icinga2 & Puppetwith Icinga2 & Puppet Tom De Vylder @tomdevylder
  • 2. whoiswhois ● Ops guyOps guy ● Rusty, old, Bavarian vehicles enthousiastRusty, old, Bavarian vehicles enthousiast ● The one who always gets the patdown at checkpointsThe one who always gets the patdown at checkpoints ● Open Source Consultant & Enthousiast at InuitsOpen Source Consultant & Enthousiast at Inuits ● Team Packages & Tools at IcingaTeam Packages & Tools at Icinga
  • 4. Monitoring!Monitoring! Image credits: http://mta.hu/data/cikk/13/00/73/cikk_130073/20120611-144546.jpgImage credits: http://mta.hu/data/cikk/13/00/73/cikk_130073/20120611-144546.jpg
  • 6. Monitoring is...Monitoring is... ● BoringBoring ● TediousTedious ● RepetitiveRepetitive ● Production =Production = deploymentdeployment + monitoring + backup+ monitoring + backup ● Often neglectedOften neglected
  • 7. Monitoring is...Monitoring is... ● BoringBoring ● TediousTedious ● RepetitiveRepetitive ● Production =Production = deploymentdeployment + monitoring + backup+ monitoring + backup ● Often neglectedOften neglected
  • 8. Why can'tWhy can't someone else do it?someone else do it?
  • 9. Someone else!Someone else! ● TediousTedious ● RepetitiveRepetitive ● People make mistakesPeople make mistakes ● Nobody likes Nagios configsNobody likes Nagios configs
  • 10. Someone else!Someone else! ● TediousTedious ● RepetitiveRepetitive ● People make mistakesPeople make mistakes ● Nobody likes Nagios configsNobody likes Nagios configs ● Monitor servers not peopleMonitor servers not people Image credits: https://openclipart.org/image/2400px/svg_to_png/219371/You-Are-Being-Monitored.pngImage credits: https://openclipart.org/image/2400px/svg_to_png/219371/You-Are-Being-Monitored.png
  • 11. Single source of truthSingle source of truth
  • 13. Config management!Config management! PuppetPuppet RudderRudder JujuJuju ChefChef AnsibleAnsible SaltstackSaltstack CFEngineCFEngine TrueConfigTrueConfig
  • 15. PuppetPuppet ● Config management toolConfig management tool ● Exported resourcesExported resources ● PuppetDBPuppetDB ● Nagios_* {} resource typesNagios_* {} resource types
  • 16. node “web.example.org” { @@nagios_host { $::fqdn: ensure => present, alias => $::hostname, address => $::ipaddress, use => "generic-host", } @@nagios_service { "check_ping_${::fqdn}": check_command => "check_ping", use => "generic-service", host_name => $::fqdn", notification_period => "24x7", service_description => "${::fqdn}_check_ping", } }
  • 17. Nagios_* {} resource typesNagios_* {} resource types node icinga.example.org { Nagios_host <<||>> Nagios_service <<||>> }
  • 18. Nagios_* {} resource typesNagios_* {} resource types @@nagios_host { $::fqdn: ensure => absent, } @@nagios_service { "check_ping_${::fqdn}": ensure => absent, }
  • 19. Nagios_* {} resource typesNagios_* {} resource types Nagios_host <<||>> Nagios_service <<||>>
  • 20. Nagios_* {} resource typesNagios_* {} resource types /etc/nagios/
  • 21. PuppetPuppet ● Config management toolConfig management tool ● Exported resourcesExported resources ● PuppetDBPuppetDB ● Nagios_* resource typesNagios_* resource types
  • 22. PuppetPuppet ● Config management toolConfig management tool ● Exported resourcesExported resources ● PuppetDBPuppetDB ● Nagios_* resource typesNagios_* resource types ● https://github.com/Icinga/puppet-icinga2https://github.com/Icinga/puppet-icinga2 ● https://github.com/Icinga/puppet-icingaweb2https://github.com/Icinga/puppet-icingaweb2
  • 23. Puppet-Icinga2Puppet-Icinga2 puppet-icinga2 (develop) ☃ git log | tail -4 Author: Nick Chappell Date: Fri May 2 19:36:32 2014 -0700 Initial commit.
  • 24. Other tools...Other tools... ● https://github.com/Icinga/puppet-icinga2https://github.com/Icinga/puppet-icinga2 ● https://github.com/Icinga/puppet-icingaweb2https://github.com/Icinga/puppet-icingaweb2 ● https://github.com/Icinga/icinga2-ansiblehttps://github.com/Icinga/icinga2-ansible ● https://github.com/Icinga/docker-icinga2https://github.com/Icinga/docker-icinga2 ● https://github.com/Icinga/chef-icinga2https://github.com/Icinga/chef-icinga2
  • 25. Puppet asPuppet as central source of truthcentral source of truth
  • 31. template Service "generic-service" { max_check_attempts = 3 check_interval = 5min retry_interval = 5min enable_perfdata = true } apply Service "ping4" { import "generic-service" check_command = "ping4" assign where host.address } apply Service "ping6" { import "generic-service" check_command = "ping6 assign where host.address6 } Icinga2Icinga2
  • 32. apply Service "ssh" { import "generic-service" check_command = "ssh" assign where host.address && host.vars.os == "Linux" } Icinga2Icinga2
  • 33. object HostGroup "database" { display_name = "Database Servers" assign where match("mysql*", host.name) assign where match("psql*", host.name) assign where match("db*", host.name) } Icinga2Icinga2
  • 34. Icinga2Icinga2 ● ApplyApply rulesrules ● Assign rulesAssign rules ● Exported resourcesExported resources
  • 35. node 'web.example.org' { @@::icinga2::object::host { $::fqdn: groups => ['puppet', $::operatingsystem], target_dir => '/etc/icinga2/objects/hosts', target_file_name => "${::fqdn}.conf", template_to_import => 'linux-host', vars => { distro => $::operatingsystem, distro_version => $::operatingsystemrelease, virtual_machine => $::is_virtual, puppet_version => $::puppetversion, puppet_environment => $::environment, }, } }
  • 36. node 'web.example.org' { @@::icinga2::object::host { $::fqdn: groups => ['puppet', $::operatingsystem], target_dir => '/etc/icinga2/objects/hosts', target_file_name => "${::fqdn}.conf", template_to_import => 'linux-host', vars => { distro => $::operatingsystem, distro_version => $::operatingsystemrelease, virtual_machine => $::is_virtual, puppet_version => $::puppetversion, puppet_environment => $::environment, puppet_classes => $::puppet_classes, puppet_modules => $::puppet_modules, }, } }
  • 37. classes_file = '/var/lib/puppet/classes.txt' classes_hash = {} modules_array = [] File.foreach(classes_file) do |l| modules_array << l.chomp.gsub(/::.*/, '') end modules_array = modules_array.sort.uniq modules_array.each do |i| classes_array = [] classes_array << i File.foreach(classes_file) do |l| classes_array << l.chomp if l =~ /^#{i}/ classes_array = classes_array.sort.uniq end classes_hash[i] = classes_array end
  • 38. Facter.add(:puppet_modules, :timeout => 10) do confine :kernel => 'Linux' setcode do modules_array.sort.uniq.join(', ').to_s end end Facter.add(:puppet_classes, :timeout => 10) do confine :kernel => 'Linux' setcode do classes_hash.map { |_k, v| v }.sort.uniq.join(', ').to_s end end
  • 39. # facter -p puppet_modules --yaml --- puppet_modules: - apache - collectd - concat - dnsclient - firewall - grafana - icinga2 - logrotate - mysql - postfix - ssh - stdlib - sudo - sysctl - ulimit
  • 40. # facter -p puppet_classes --yaml --- puppet_classes: mysql: - mysql - "mysql::client" - "mysql::client::install" - "mysql::server" - "mysql::server::config" - "mysql::server::install" - "mysql::server::installdb" - "mysql::server::service" icinga2: - icinga2 - "icinga2::server" - "icinga2::server::config" - "icinga2::server::features" - "icinga2::server::install" - "icinga2::server::service"
  • 41. @@::icinga2::object::host { $::fqdn: groups => ['puppet', $::operatingsystem], target_dir => '/etc/icinga2/objects/hosts', target_file_name => "${::fqdn}.conf", template_to_import => 'linux-host', vars => { distro => $::operatingsystem, distro_version => $::operatingsystemrelease, virtual_machine => $::is_virtual, puppet_version => $::puppetversion, puppet_environment => $::environment, puppet_classes => inline_template( '<%= puppet_classes.collect { |k, v| v }.sort.join(" ") %>' ), puppet_modules => inline_template( '<%= puppet_modules.sort.join(" ") %>' ), }, }
  • 42. icinga2::object::apply_service_to_host { 'mysql_server': check_command => 'by_ssh', display_name => 'MySQL', target_dir => '/etc/icinga2/objects/applys', assign_where => '"match(*mysql::server*", host.vars.puppet_classes)"', vars => { by_ssh_command => "check_tcp -H localhost -p 3306", by_ssh_logname => 'root', by_ssh_quiet => true, by_ssh_timeout => 60, }, }
  • 44. There's a better wayThere's a better way
  • 46. curl -s -X GET http://puppetdb:8080/pdb/query/v4/resources --data-urlencode 'query=["extract", "certname", ["and", ["=", "type", "Class"], ["~", "title", "^Settings"] ] ]' Query PuppetDBQuery PuppetDB
  • 48.
  • 49. $nodes = query_nodes('Class[Settings]', 'fqdn') PuppetDBqueryPuppetDBquery
  • 50. $nodes = query_nodes('Class[Settings]', 'fqdn') notify { "${nodes}": } # puppet agent --test –noop Info: Applying configuration version '1447591034' Notice: /Stage[main]/Main/Notify[web.example.org, db.example.org, icinga2.example.org, puppet.example.org]/message: current_value absent, should be [web.example.org, db.example.org, icinga2.example.org, puppet.example.org] (noop) Notice: Applied catalog in 0.21 seconds PuppetDBqueryPuppetDBquery
  • 51. $nodes = query_nodes('Class[Mysql::Server]', 'fqdn') notify { "${nodes}": } # puppet agent --test –noop Info: Applying configuration version '1447591391' Notice: /Stage[main]/Main/Notify[db.example.org]/message: current_value absent, should be db.example.org (noop) Notice: Applied catalog in 0.21 seconds PuppetDBqueryPuppetDBquery
  • 52. $nodes = query_nodes('Class[Settings]', 'fqdn') define monitor::host ($host_name) { $foo.each |Integer $index, String $host| { ::icinga2::object::host { $host: groups => ['puppet', $::operatingsystem], target_dir => '/etc/icinga2/objects/hosts', target_file_name => "${host}.conf", template_to_import => 'linux-host', } } } ::monitor::host { 'all': host_name => $nodes, } PuppetDBqueryPuppetDBquery
  • 53. SummarySummary ● No more exported resourcesNo more exported resources ● Automagically worksAutomagically works ● Production = deployment +Production = deployment + monitoringmonitoring + backup+ backup ● Purge decommissioned nodesPurge decommissioned nodes
  • 54.
  • 55. ContactContact Tom De VylderTom De Vylder @tomdevylder@tomdevylder tomdv@inuits.eutomdv@inuits.eu INUITS bvbaINUITS bvba Heidestraat 257Heidestraat 257 2070 Zwijndrecht2070 Zwijndrecht BelgiumBelgium +32 475 961221+32 475 961221 info@inuits.euinfo@inuits.eu