The road to lazy monitoring with Icinga2 & Puppet. Tom De Vylder @tomdevylder



Similar documents
Secure Linux Administration Conference Bernd Strößenreuther

TF-NOC Dublin. Alexandros Kosiaris GRNET NOC Use puppet and network inventory to populate nagios/icinga configuration

SIG-NOC Meeting - Stuttgart 04/08/2015 Icinga - Open Source Monitoring

NRPE Documentation CONTENTS. 1. Introduction... a) Purpose... b) Design Overview Example Uses... a) Direct Checks... b) Indirect Checks...

Icinga and Puppet Dominik Schulz Head of Datacenter and Operations Magic Internet / MyVideo

Ansible. Configuration management tool and ad hoc solution. Marcel Nijenhof

Using Vagrant for Magento development. Alexander

Pro Puppet. Jeffrey McCune. James TurnbuII. Apress* m in

The Puppet Show Managing Servers with Puppet

developing sysadmin - sysadmining developers

Timofey Turenko. Kirill Krinkin St-Petersburg Electrotechnical University

CHEF IN THE CLOUD AND ON THE GROUND

Building Hosts with Puppet

Kickstart & Booking. Kristian Köhntopp, booking.com

Deploying Foreman in Enterprise Environments 2.0. best practices and lessons learned. Nils Domrose Cologne, August,

Monitoring MySQL. Geert Vanderkelen MySQL Senior Support Engineer Sun Microsystems

Setting Up A Nagios Monitoring System Warren Block, May 2005

ABRAHAM ARCHITECTURE OF A CLOUD SERVICE USING PYTHON TECHNOLOGIES

While are you still in Nagios working directory, create a new file for DNS servers monitoring

ICINGA2 OPEN SOURCE MONITORING

HowTo Check. Microsoft Cluster. Functionality via SNMP

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP LTM with the Nagios Open Source Network Monitoring System

Continuous Integration using Docker & Jenkins

How to Deploy a Secure, Highly-Available Hadoop Platform

Making System Administration Easier by Letting the Machines Do the Hard Work, Or, Becoming an Agile Sysadmin

Installation documentation for Ulteo Open Virtual Desktop

Ulteo Open Virtual Desktop Installation

How To Monitor A Network With Nagios And Other Tools

Availability Management Nagios overview. TEIN2 training Bangkok September 2005

Ansible. swiss army knife orchestration

Monitoring Systems and Services. Alwin Brokmann DESY-IT March 24 28,2003 CHEP 2003 San Diego

OpenITSM - IT Service Management with Open Source Software

Monitoring Software Services registered with science.canarie.ca

OpenITSM - IT Service Management with Open Source Software

Taking Drupal development to the Cloud. Karel Bemelmans

deploying meteor with meteor up

Nagios. cooler than it looks. Wednesday, 31 October 2007

CMDBs and Check_MK Linux höchstpersönlich.

Continuous Integration In challenging environments w/ Ansible. PyCon5 Italy, Cesare Placanica

Continuous security audit automation with Spacewalk, Puppet, Mcollective and SCAP

Installing Booked scheduler on CentOS 6.5

Supermicro Server Monitoring with SuperDoctor 5 and Nagios Using SNMP Protocol. Version 1.1b

Parallels Plesk Automation

Monitoring VoIP Systems. Sebastian Damm

Monitoring a Linux Mail Server

OS Installation: CentOS 5.8

Creating a dynamic software deployment solution using free/libre software

System Admin Module User Guide. Schmooze Com Inc.

Nagios introduction. Dhruba Raj Bhandari (CCNA) Additions by Phil Regnauld.

Cloud-init. Marc Skinner - Principal Solutions Architect Michael Heldebrant - Solutions Architect Red Hat

Advantages and Disadvantages of Application Network Marketing Systems

Network Monitoring Systems / Nagios. 2/19/08 Michael Miller e mail: mike.mikemiller@gmail.com

Newton Linux User Group Graphing SNMP with Cacti and RRDtool

Smartphone Pentest Framework v0.1. User Guide

DevOoops Increase awareness around DevOps infra security. Gianluca

Présentation de Nagios

CN=Monitor Installation and Configuration v2.0

Are my systems alive secure?

Integrating SAP BusinessObjects with Hadoop. Using a multi-node Hadoop Cluster

Nagios Web Service Checker

System management with Spacewalk

SYSTEM BACKUP AND RESTORE (AlienVault USM 4.8+)

Getting Hadoop, Hive and HBase up and running in less than 15 mins

NETWORK MONITOR. Some high-end network monitoring. Watching your systems with Nagios COVER STORY. What Is Nagios? Installing the Server and Plugins

IBM Redistribute Big SQL v4.x Storage Paths IBM. Redistribute Big SQL v4.x Storage Paths

INUVIKA OVD INSTALLING INUVIKA OVD ON UBUNTU (TRUSTY TAHR)

SUSE Manager in the Public Cloud. SUSE Manager Server in the Public Cloud

How To Run Nrpe On Nagios On Windows 7.5 (Windows) On A Linux Computer On A Windows 7 (Windows 7) On An Ubuntu Computer On An Ipad Or Ipad (Windows 8) On Your Pc

Managing SAS Web Infrastructure Platform Data Server High-Availability Clusters

Of Pets and Cattle and Hearts

Setting up your virtual infrastructure using FIWARE Lab Cloud

1 Keystone OpenStack Identity Service

Network Monitoring with Nagios. Matt Gracie, Information Security Administrator Canisius College, Buffalo, NY

SolarWinds Log & Event Manager

Robust & Reliable DNS Operations Logging & Monitoring

Document d'installation FAN 2.1

Bazaarvoice for Magento

Deploy Big Data Extensions on vsphere Standard Edition

ULTEO OPEN VIRTUAL DESKTOP UBUNTU (PRECISE PANGOLIN) SUPPORT

VDCF - Virtual Datacenter Control Framework for the Solaris TM Operating System

Our Puppet Story Patterns and Learnings

Multivendor Extension User Guide

Configuring Avaya Aura Communication Manager and Avaya Call Management System Release 16.3 with Avaya Contact Center Control Manager Issue 1.

How To Monitor A Network With Nagios And Rt Software On Linux On A Microsoft Ipad (A2) On A Pc Or Macbook Or Ipad Or Ipa (A3) On An Ipa Or Ipo (

Ruby on Rails (Ruby 1.9.2, Rails 3.1.1) Installation

Building a big IaaS cloud with Apache CloudStack

Utilizing Ansible to Manage a Highly Available MySQL Environment

The Nagios check_logfiles plugin helps you monitor your logfiles even if the logs rotate and change names.

Configuration Management Change Management, and Culture Management

Linux logging and logfiles monitoring with swatch

Introduction to the Domain Name System

Tools and Integration

Installing and Running MOVES on Linux

Transcription:

The road to lazy monitoring with Icinga2 & Puppet Tom De Vylder @tomdevylder

whois Ops guy Rusty, old, Bavarian vehicles enthousiast The one who always gets the patdown at checkpoints Open Source Consultant & Enthousiast at Inuits Team Packages & Tools at Icinga

Monitoring!

Monitoring! Image credits: http://mta.hu/data/cikk/13/00/73/cikk_130073/20120611-144546.jpg

Monitoring :((

Monitoring is... Boring Tedious Repetitive Production = deployment + monitoring + backup Often neglected

Monitoring is... Boring Tedious Repetitive Production = deployment + monitoring + backup Often neglected

Why can't someone else do it?

Someone else! Tedious Repetitive People make mistakes Nobody likes Nagios configs

Someone else! Tedious Repetitive People make mistakes Nobody likes Nagios configs Monitor servers not people Image credits: https://openclipart.org/image/2400px/svg_to_png/219371/you-are-being-monitored.png

Single source of truth

Config management!

Puppet Rudder Juju Chef Config management! Ansible Saltstack TrueConfig CFEngine

Puppet

Puppet Config management tool Exported resources PuppetDB Nagios_* {} 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 types node icinga.example.org { Nagios_host << >> Nagios_service << >> }

Nagios_* {} resource types @@nagios_host { $::fqdn: ensure => absent, } @@nagios_service { "check_ping_${::fqdn}": ensure => absent, }

Nagios_* {} resource types Nagios_host << >> Nagios_service << >>

Nagios_* {} resource types /etc/nagios/

Puppet Config management tool Exported resources PuppetDB Nagios_* resource types

Puppet Config management tool Exported resources PuppetDB Nagios_* resource types https://github.com/icinga/puppet-icinga2 https://github.com/icinga/puppet-icingaweb2

Puppet-Icinga2 puppet-icinga2 (develop) git log tail -4 Author: Nick Chappell Date: Fri May 2 19:36:32 2014-0700 Initial commit.

Other tools... https://github.com/icinga/puppet-icinga2 https://github.com/icinga/puppet-icingaweb2 https://github.com/icinga/icinga2-ansible https://github.com/icinga/docker-icinga2 https://github.com/icinga/chef-icinga2

Puppet as central source of truth

Exported resources

Exported resources

Collected resources

Icinga2

Icinga2 Apply rules Assign rules

Icinga2 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 }

Icinga2 apply Service "ssh" { import "generic-service" check_command = "ssh" assign where host.address && host.vars.os == "Linux" }

Icinga2 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) }

Icinga2 Apply rules Assign rules Exported resources

node 'web.example.org' { @@::icinga2::object::host groups => target_dir => target_file_name => template_to_import => vars => distro => distro_version => virtual_machine => puppet_version => puppet_environment => }, } } { $::fqdn: ['puppet', $::operatingsystem], '/etc/icinga2/objects/hosts', "${::fqdn}.conf", 'linux-host', { $::operatingsystem, $::operatingsystemrelease, $::is_virtual, $::puppetversion, $::environment,

node 'web.example.org' { @@::icinga2::object::host groups => target_dir => target_file_name => template_to_import => vars => distro => distro_version => virtual_machine => puppet_version => puppet_environment => puppet_classes => puppet_modules => }, } } { $::fqdn: ['puppet', $::operatingsystem], '/etc/icinga2/objects/hosts', "${::fqdn}.conf", 'linux-host', { $::operatingsystem, $::operatingsystemrelease, $::is_virtual, $::puppetversion, $::environment, $::puppet_classes, $::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 resources

There's a better way

Query PuppetDB

Query PuppetDB curl \ -s \ -X GET \ http://puppetdb:8080/pdb/query/v4/resources \ --data-urlencode \ 'query=["extract", "certname", ["and", ["=", "type", "Class"], ["~", "title", "^Settings"] ] ]'

PuppetDBquery

PuppetDBquery $nodes = query_nodes('class[settings]', 'fqdn')

PuppetDBquery $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

PuppetDBquery $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

PuppetDBquery $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, }

Summary No more exported resources Automagically works Production = deployment + monitoring + backup Purge decommissioned nodes

Contact Tom De Vylder @tomdevylder tomdv@inuits.eu INUITS bvba Heidestraat 257 2070 Zwijndrecht Belgium +32 475 961221 info@inuits.eu