SlideShare a Scribd company logo
WWW.ICINGA.ORGWWW.ICINGA.ORG
Icinga 2
Hacking Session
Icinga 2
Hacking Session
Icinga 2 Workshop
2014-10-10
Icinga 2 Workshop
2014-10-10
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
• Icinga Cluster VMs
• A look on the config
• Configuration & Practice
• Cluster reconfiguration
• Questions & Answers
AgendaAgenda
Icinga 2 Workshop
Cluster VMsCluster VMs
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Cluster VMsCluster VMs
Icinga 2 Workshop
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Cluster VMsCluster VMs
Icinga 2 Workshop
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Cluster VMsCluster VMs
Icinga 2 Workshop
Icinga2a:
OpenSSH: ssh root@localhost -p 2085
PuTTy: root@localhost:2085
Icinga2b:
OpenSSH: ssh root@localhost -p 2086
PuTTy: root@localhost:2086
SSH Login:
root / vagrant
vagrant / vagrant
Web:
http://localhost:8085
User: icingaadmin
Password: icinga
See the docs for instructions for the VM source definitions
http://docs.icinga.org/icinga2 → Vagrant
ConfigurationConfiguration
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Important PathsImportant Paths
Icinga 2 Workshop
/etc/icinga2 Main configuration
/usr/sbin/icinga2 Daemon
/usr/(s)bin/icinga2-* CLI tools
/usr/share/icinga2 ITL and plugin Commands
/var/run/icinga PID file and command pipe
/var/cache/icinga2 status.dat / objects.cache
/var/lib/icinga2 state file, cluster data
/var/spool/icinga2 performance data
/var/log/icinga2 logfiles
service icinga2 start|stop|restart|reload
service icinga2 checkconfig
icinga2-list-objects --color | less -R
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Icinga 2 Workshop
DemoDemo
DEMO
Configuration & practiceConfiguration & practice
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Host / Hostgroup / ServiceHost / Hostgroup / Service
Icinga 2 Workshop
object HostGroup "mysql-server" {
display_name = "MySQL Server"
assign where match("*mysql*", host.name)
assign where match("db-*", host.vars.prod_mysql_db)
ignore where host.vars.test_server == true
ignore where match("*internal", host.name)
}
object Host "mysql-db1" {
import "db-server"
import "mysql-server"
address = "192.168.70.10"
}
object Host "customer-db7" {
import "db-server"
import "mysql-server"
address = "192.168.71.30"
vars.prod_mysql_db = "db-customer-xy"
}
apply Service "mysql-health" {
import "mysql-service"
check_command = "mysql"
assign where "mysql-server" in host.groups
ignore where host.vars.no_health_check == true
}
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Custom check commandsCustom check commands
Icinga 2 Workshop
object CheckCommand "training-mysql" {
import "training-mysql-common"
command = [ PluginDir + "/check_mysql" ]
arguments = {
"-H" = "$mysql_host$"
"-u" = "$mysql_user$"
"-p" = "$mysql_password$"
"-P" = "$mysql_port$"
"-s" = "$mysql_socket$"
"-a" = "$mysql_cert$"
"-k" = "$mysql_key$"
"-f" = "$mysql_optfile$"
"-g" = "$mysql_group$"
"-S" = {
set_if = "$mysql_check_slave$"
description = "Check if the slave thread is running properly."
}
"-l" = {
set_if = "$mysql_ssl$"
description = "Use ssl encryption"
}
}
vars.mysql_check_slave = false
vars.mysql_ssl = false
}
template CheckCommand "training-mysql-common" {
import "plugin-check-command"
vars.mysql_host = "$address$"
}
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Custom check commandsCustom check commands
Icinga 2 Workshop
template Host "mysql-server" {
check_interval = 3m
vars.mysql_port = 3306
}
object Host "training-mysql-db1" {
import "mysql-server"
address = "127.0.0.1"
}
object Host "training-mysql-db2" {
import "mysql-server"
address = "127.0.0.1"
}
apply Service "mysql-connection" {
import "mysql-service"
check_command = "training-mysql"
vars.mysql_database = "mysql"
assign where "mysql-server" in host.groups
}
object HostGroup "mysql-server" {
display_name = "MySQL Server"
assign where match("*mysql*", host.name)
assign where match("db-*",
host.vars.prod_mysql_db)
ignore where host.vars.test_server == true
ignore where match("*internal", host.name)
}
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
PracticePractice
• Erstellen Sie die Hosts:
workshop-1 (192.168.33.10) und
workshop-2 (192.168.33.20)
mit der var customer = “icinga“
• Erstellen Sie eine Hostgroup „icinga“ die alle Hosts enthält, bei
denen customer auf „icinga“ gesetzt ist
assign where host.vars.customer == "icinga"
• Weisen Sie einen http Service (apply) für beide Hosts zu,
der die URI “/icingaweb” prüft
→ /usr/share/icinga2/include/command-plugins.conf
→ http_uri
→ assign where match("workshop*", host.name)
• Erstellen Sie eine ServiceGroup „icinga-http“ und setzen Sie
die eben erstellen Services in diese Gruppe
Icinga 2 Workshop
/etc/icinga2/zones.d/checker/workshop.conf
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Practice solutionPractice solution
Icinga 2 Workshop
object Host "workshop-1" {
import "generic-host"
address = "192.168.33.10"
vars.customer = "icinga"
}
object Host "workshop-2" {
import "generic-host"
address = "192.168.33.20"
vars.customer = "icinga"
}
object HostGroup "icinga" {
assign where host.vars.customer == "icinga"
}
apply Service "http" {
check_command = "http"
vars.http_uri = "/icingaweb"
groups += [ "icinga-http" ]
assign where match("workshop*", host.name)
}
object ServiceGroup "icinga-http" {
}
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
NotificationNotification
Icinga 2 Workshop
template Notification "notify-mysql-users" {
command = "mail-service-notification"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
period = "24x7"
user_groups = [ "icingaadmins" ]
}
apply Notification "mysql-status" to Service {
import "notify-mysql-users"
assign where match("*mysql*", service.check_command)
ignore where services.vars.disable_mysql_notifications == true
}
apply Notification "notify-cust-icinga-mysql" to Service {
import "cust-icinga-notification"
assign where match("*mysql*", service.check_command) &&
host.vars.customer == "icinga"
ignore where match("*internal", host.name)
ignore where service.vars.sla != "24x7"
}
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
DependencyDependency
Icinga 2 Workshop
apply Service "nrpe-health" {
import "generic-service"
check_command = "nrpe"
assign where host.vars.agent == "nrpe"
}
apply Service "nrpe-load" {
import "generic-service"
check_command = "nrpe"
vars.nrpe_command = "check_load"
assign where host.vars.agent == "nrpe"
}
apply Service "nrpe-disk" {
import "generic-service"
check_command = "nrpe"
vars.nrpe_command = "check_disk"
assign where
host.vars.agent == "nrpe"
}
object Host "nrpe-server" {
import "generic-host"
address = "192.168.1.5"
vars.agent = "nrpe"
}
apply Dependency "disable-nrpe-checks" to Service
parent_service_name = "nrpe-health"
states = [ OK ]
disable_checks = true
disable_notifications = true
assign where service.check_command == "nrpe" &&
host.vars.agent == "nrpe"
ignore where service.name == "nrpe-health"
}
Reconfigure ClusterReconfigure Cluster
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
Reconfigure to Master-MasterReconfigure to Master-Master
• Wir lösen die Zone checker auf und nehmen icinga2b in die
Master Zone auf
• Icinga 2 auf beiden Seiten stoppen
• Gecachte Cluster Daten löschen (beide Seiten)
rm -rf /var/lib/icinga2/api/zones/*
• zones.conf auf beiden Servern editieren
• Inhalt von /etc/icinga2/zones.d/checker/ nach ../master/
verschieben
• IDO HA Funktion deaktivieren
• Icinga 2 wieder starten
Icinga 2 Workshop
# vim /etc/icinga2/features-enabled/ido-mysql.conf
object IdoMysqlConnection "ido-mysql" {
enable_ha = false
}
object Zone "master" {
endpoints = [ "icinga2a", "icinga2b" ]
}
DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG
QUESTIONS & ANSWERSQUESTIONS & ANSWERS
Icinga 2 Workshop
Web + Blog www.icinga.org
Docs docs.icinga.org
Development dev.icinga.org
Sourcecode git.icinga.org
Releases github.com/Icinga
Wiki wiki.icinga.org
IRC #icinga on FreeNode
Mailing lists lists.icinga.org
Support support.icinga.org
Twitter twitter.com/icinga
Facebook facebook.com/icinga
…….. Everywhere!
?
Questions & Answers

More Related Content

PDF
What is new in icinga2
PPTX
Icinga2 - Upcoming API for Icinga2
PDF
Icinga 2010 at Nagios Workshop
PDF
Icinga 2 and puppet: automate monitoring
PDF
Toshaan Bharvani – Icinga2 and Ansible, how to manage and migrate
PDF
Why favour Icinga over Nagios @ FrOSCon 2015
PDF
Icinga Web 2 is more - Module magic at Icinga Camp San Francisco
PPTX
Icinga lsm 2015 copy
What is new in icinga2
Icinga2 - Upcoming API for Icinga2
Icinga 2010 at Nagios Workshop
Icinga 2 and puppet: automate monitoring
Toshaan Bharvani – Icinga2 and Ansible, how to manage and migrate
Why favour Icinga over Nagios @ FrOSCon 2015
Icinga Web 2 is more - Module magic at Icinga Camp San Francisco
Icinga lsm 2015 copy

What's hot (20)

PDF
OSMC 2014: Current state of Icinga | Icinga Team
PPTX
Icinga2
PDF
Rundeck: The missing tool
PDF
Icinga 2 and Puppet - Automate Monitoring
PDF
Andrew Nelson - Zabbix and SNMP on Linux
PDF
Make your Ansible playbooks maintainable, flexible, and scalable
PDF
Jesse Olson - Nagios Log Server Architecture Overview
PDF
RunDeck
PDF
HTTPS and Ansible
ODP
Automating Monitoring with Puppet
PDF
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
PDF
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
PDF
Testing with Ansible
PDF
Red Hat Satellite 6 - Automation with Puppet
PDF
Ansible at work
PPTX
How to deploy spark instance using ansible 2.0 in fiware lab v2
PPTX
Securing Hadoop @eBay
PDF
OpenStack Austin Meetup January 2014: Chef + OpenStack
PDF
Stop using Nagios (so it can die peacefully)
PDF
From pets to cattle - powered by CoreOS, docker, Mesos & nginx
OSMC 2014: Current state of Icinga | Icinga Team
Icinga2
Rundeck: The missing tool
Icinga 2 and Puppet - Automate Monitoring
Andrew Nelson - Zabbix and SNMP on Linux
Make your Ansible playbooks maintainable, flexible, and scalable
Jesse Olson - Nagios Log Server Architecture Overview
RunDeck
HTTPS and Ansible
Automating Monitoring with Puppet
SCALE12X Build a Cloud Day: Chef: The Swiss Army Knife of Cloud Infrastructure
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Testing with Ansible
Red Hat Satellite 6 - Automation with Puppet
Ansible at work
How to deploy spark instance using ansible 2.0 in fiware lab v2
Securing Hadoop @eBay
OpenStack Austin Meetup January 2014: Chef + OpenStack
Stop using Nagios (so it can die peacefully)
From pets to cattle - powered by CoreOS, docker, Mesos & nginx

Viewers also liked (20)

PDF
Monitoring with Icinga2 at Adobe
PDF
Performance Monitoring with Icinga2, Graphite und Grafana
PPTX
Icinga Camp Antwerp - Icinga2 Cluster
PPTX
Cebit 2015 icinga
PDF
Icinga Camp San Diego: Apify them all
PPTX
Presentation about Icinga at Kiratech DevOps Day in Verona
PDF
Icinga Camp San Diego 2016 - Icinga Director
PPTX
Icinga Camp Amsterdam - How to monitor Windows
PDF
IcingaCamp Stockholm - NSClient++
PDF
Icinga 2 - Apify them all at Icinga Camp Amsterdam 2016
PDF
IcingaCamp Stockholm - How to make your monitoring shut up
ODP
Icinga Camp Amsterdam - Infrastructure as Code
ODP
Icinga Camp Belgrade - ITAF Introduction
PPTX
Icinga Camp Amsterdam - Monitoring – When to start
PDF
Icinga Camp Amsterdam - Icinga, Graphite, Grafana
PDF
Icinga Camp Amsterdam - Icinga Director
PPTX
IcingaCamp Stockholm - Icinga Web2
PDF
Icinga Camp Amsterdam - Icinga2 and Ansible
PPTX
Icinga Camp San Diego 2016 - Icinga Web 2
PPTX
Icinga Camp San Diego 2016 - Opening
Monitoring with Icinga2 at Adobe
Performance Monitoring with Icinga2, Graphite und Grafana
Icinga Camp Antwerp - Icinga2 Cluster
Cebit 2015 icinga
Icinga Camp San Diego: Apify them all
Presentation about Icinga at Kiratech DevOps Day in Verona
Icinga Camp San Diego 2016 - Icinga Director
Icinga Camp Amsterdam - How to monitor Windows
IcingaCamp Stockholm - NSClient++
Icinga 2 - Apify them all at Icinga Camp Amsterdam 2016
IcingaCamp Stockholm - How to make your monitoring shut up
Icinga Camp Amsterdam - Infrastructure as Code
Icinga Camp Belgrade - ITAF Introduction
Icinga Camp Amsterdam - Monitoring – When to start
Icinga Camp Amsterdam - Icinga, Graphite, Grafana
Icinga Camp Amsterdam - Icinga Director
IcingaCamp Stockholm - Icinga Web2
Icinga Camp Amsterdam - Icinga2 and Ansible
Icinga Camp San Diego 2016 - Icinga Web 2
Icinga Camp San Diego 2016 - Opening

Similar to Icinga2 Hacking Session 2014-10-10 (20)

PDF
Icinga Workshop 2014 Icinga 2 Hacking Session
PPTX
Icinga 2 at Icinga Camp San Francisco
PPTX
Why favour Icinga over Nagios - Rootconf 2015
PDF
Integrating icinga2 and the HashiCorp suite
PPTX
Monitoring as code
PDF
OSDC 2015: Bernd Erk | Why favour Icinga over Nagios
PDF
Cutting through the fog of cloud
PDF
Why favor Icinga over Nagios @ DebConf15
PPTX
State of Icinga - Linux Stammtisch München
PDF
Burn down the silos! Helping dev and ops gel on high availability websites
PDF
Antons Kranga Building Agile Infrastructures
PPTX
Journey to the Cloud
PDF
Deploying OpenStack with Chef
PDF
Introduction to Chef
PDF
NGINX Can Do That? Test Drive Your Config File!
PDF
The Subtle Art Of Cache Invalidation (FOSSingapore 2024)
PPTX
Software Defined Datacenter
PDF
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
ODP
Puppetpreso
PDF
Spark summit2014 techtalk - testing spark
Icinga Workshop 2014 Icinga 2 Hacking Session
Icinga 2 at Icinga Camp San Francisco
Why favour Icinga over Nagios - Rootconf 2015
Integrating icinga2 and the HashiCorp suite
Monitoring as code
OSDC 2015: Bernd Erk | Why favour Icinga over Nagios
Cutting through the fog of cloud
Why favor Icinga over Nagios @ DebConf15
State of Icinga - Linux Stammtisch München
Burn down the silos! Helping dev and ops gel on high availability websites
Antons Kranga Building Agile Infrastructures
Journey to the Cloud
Deploying OpenStack with Chef
Introduction to Chef
NGINX Can Do That? Test Drive Your Config File!
The Subtle Art Of Cache Invalidation (FOSSingapore 2024)
Software Defined Datacenter
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
Puppetpreso
Spark summit2014 techtalk - testing spark

More from Icinga (20)

PDF
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
PDF
Extending Icinga Web with Modules: powerful, smart and easily created - Icing...
PDF
Infrastructure Monitoring for Cloud Native Enterprises - Icinga Camp Milan 2023
PDF
Incident management: Best industry practices your team should know - Icinga C...
PDF
Monitoring Cooling Units in a pharmaceutical GxP regulated environment - Icin...
PDF
SNMP Monitoring at scale - Icinga Camp Milan 2023
PPTX
Monitoring Kubernetes with Icinga - Icinga Camp Milan 2023
PPTX
Current State of Icinga - Icinga Camp Milan 2023
PDF
Efficient IT operations using monitoring systems and standardized tools - Ici...
PPTX
Tornado Complex Event Processing Framework for Icinga - Icinga Camp Zurich 2019
PDF
Signalilo: Visualizing Prometheus alerts in Icinga2 - Icinga Camp Zurich 2019
PDF
Moving from Icinga 1 to Icinga 2 + Director - Icinga Camp Zurich 2019
PDF
Icinga Director and vSphereDB - how they play together - Icinga Camp Zurich 2019
PDF
Current State of Icinga - Icinga Camp Zurich 2019
PDF
NetEye 4 based on Icinga 2 - Icinga Camp Milan 2019
PDF
Integrating Icinga 2 and ntopng - Icinga Camp Milan 2019
PDF
DevOps monitoring: Best Practices using OpenShift combined with Icinga & Big ...
PPTX
Current State of Icinga - Icinga Camp Milan 2019
PPTX
Best of Icinga Modules - Icinga Camp Milan 2019
PPTX
hallenges of Monitoring Big Infrastructure - Icinga Camp Milan 2019
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Extending Icinga Web with Modules: powerful, smart and easily created - Icing...
Infrastructure Monitoring for Cloud Native Enterprises - Icinga Camp Milan 2023
Incident management: Best industry practices your team should know - Icinga C...
Monitoring Cooling Units in a pharmaceutical GxP regulated environment - Icin...
SNMP Monitoring at scale - Icinga Camp Milan 2023
Monitoring Kubernetes with Icinga - Icinga Camp Milan 2023
Current State of Icinga - Icinga Camp Milan 2023
Efficient IT operations using monitoring systems and standardized tools - Ici...
Tornado Complex Event Processing Framework for Icinga - Icinga Camp Zurich 2019
Signalilo: Visualizing Prometheus alerts in Icinga2 - Icinga Camp Zurich 2019
Moving from Icinga 1 to Icinga 2 + Director - Icinga Camp Zurich 2019
Icinga Director and vSphereDB - how they play together - Icinga Camp Zurich 2019
Current State of Icinga - Icinga Camp Zurich 2019
NetEye 4 based on Icinga 2 - Icinga Camp Milan 2019
Integrating Icinga 2 and ntopng - Icinga Camp Milan 2019
DevOps monitoring: Best Practices using OpenShift combined with Icinga & Big ...
Current State of Icinga - Icinga Camp Milan 2019
Best of Icinga Modules - Icinga Camp Milan 2019
hallenges of Monitoring Big Infrastructure - Icinga Camp Milan 2019

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
Teaching material agriculture food technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation theory and applications.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Programs and apps: productivity, graphics, security and other tools
Diabetes mellitus diagnosis method based random forest with bat algorithm
NewMind AI Weekly Chronicles - August'25 Week I
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
MIND Revenue Release Quarter 2 2025 Press Release
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectral efficient network and resource selection model in 5G networks
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
Chapter 3 Spatial Domain Image Processing.pdf
Teaching material agriculture food technology
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation theory and applications.pdf
The AUB Centre for AI in Media Proposal.docx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Programs and apps: productivity, graphics, security and other tools

Icinga2 Hacking Session 2014-10-10

  • 1. WWW.ICINGA.ORGWWW.ICINGA.ORG Icinga 2 Hacking Session Icinga 2 Hacking Session Icinga 2 Workshop 2014-10-10 Icinga 2 Workshop 2014-10-10
  • 2. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG • Icinga Cluster VMs • A look on the config • Configuration & Practice • Cluster reconfiguration • Questions & Answers AgendaAgenda Icinga 2 Workshop
  • 4. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Cluster VMsCluster VMs Icinga 2 Workshop
  • 5. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Cluster VMsCluster VMs Icinga 2 Workshop
  • 6. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Cluster VMsCluster VMs Icinga 2 Workshop Icinga2a: OpenSSH: ssh root@localhost -p 2085 PuTTy: root@localhost:2085 Icinga2b: OpenSSH: ssh root@localhost -p 2086 PuTTy: root@localhost:2086 SSH Login: root / vagrant vagrant / vagrant Web: http://localhost:8085 User: icingaadmin Password: icinga See the docs for instructions for the VM source definitions http://docs.icinga.org/icinga2 → Vagrant
  • 8. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Important PathsImportant Paths Icinga 2 Workshop /etc/icinga2 Main configuration /usr/sbin/icinga2 Daemon /usr/(s)bin/icinga2-* CLI tools /usr/share/icinga2 ITL and plugin Commands /var/run/icinga PID file and command pipe /var/cache/icinga2 status.dat / objects.cache /var/lib/icinga2 state file, cluster data /var/spool/icinga2 performance data /var/log/icinga2 logfiles service icinga2 start|stop|restart|reload service icinga2 checkconfig icinga2-list-objects --color | less -R
  • 9. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Icinga 2 Workshop DemoDemo DEMO
  • 11. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Host / Hostgroup / ServiceHost / Hostgroup / Service Icinga 2 Workshop object HostGroup "mysql-server" { display_name = "MySQL Server" assign where match("*mysql*", host.name) assign where match("db-*", host.vars.prod_mysql_db) ignore where host.vars.test_server == true ignore where match("*internal", host.name) } object Host "mysql-db1" { import "db-server" import "mysql-server" address = "192.168.70.10" } object Host "customer-db7" { import "db-server" import "mysql-server" address = "192.168.71.30" vars.prod_mysql_db = "db-customer-xy" } apply Service "mysql-health" { import "mysql-service" check_command = "mysql" assign where "mysql-server" in host.groups ignore where host.vars.no_health_check == true }
  • 12. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Custom check commandsCustom check commands Icinga 2 Workshop object CheckCommand "training-mysql" { import "training-mysql-common" command = [ PluginDir + "/check_mysql" ] arguments = { "-H" = "$mysql_host$" "-u" = "$mysql_user$" "-p" = "$mysql_password$" "-P" = "$mysql_port$" "-s" = "$mysql_socket$" "-a" = "$mysql_cert$" "-k" = "$mysql_key$" "-f" = "$mysql_optfile$" "-g" = "$mysql_group$" "-S" = { set_if = "$mysql_check_slave$" description = "Check if the slave thread is running properly." } "-l" = { set_if = "$mysql_ssl$" description = "Use ssl encryption" } } vars.mysql_check_slave = false vars.mysql_ssl = false } template CheckCommand "training-mysql-common" { import "plugin-check-command" vars.mysql_host = "$address$" }
  • 13. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Custom check commandsCustom check commands Icinga 2 Workshop template Host "mysql-server" { check_interval = 3m vars.mysql_port = 3306 } object Host "training-mysql-db1" { import "mysql-server" address = "127.0.0.1" } object Host "training-mysql-db2" { import "mysql-server" address = "127.0.0.1" } apply Service "mysql-connection" { import "mysql-service" check_command = "training-mysql" vars.mysql_database = "mysql" assign where "mysql-server" in host.groups } object HostGroup "mysql-server" { display_name = "MySQL Server" assign where match("*mysql*", host.name) assign where match("db-*", host.vars.prod_mysql_db) ignore where host.vars.test_server == true ignore where match("*internal", host.name) }
  • 14. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG PracticePractice • Erstellen Sie die Hosts: workshop-1 (192.168.33.10) und workshop-2 (192.168.33.20) mit der var customer = “icinga“ • Erstellen Sie eine Hostgroup „icinga“ die alle Hosts enthält, bei denen customer auf „icinga“ gesetzt ist assign where host.vars.customer == "icinga" • Weisen Sie einen http Service (apply) für beide Hosts zu, der die URI “/icingaweb” prüft → /usr/share/icinga2/include/command-plugins.conf → http_uri → assign where match("workshop*", host.name) • Erstellen Sie eine ServiceGroup „icinga-http“ und setzen Sie die eben erstellen Services in diese Gruppe Icinga 2 Workshop /etc/icinga2/zones.d/checker/workshop.conf
  • 15. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Practice solutionPractice solution Icinga 2 Workshop object Host "workshop-1" { import "generic-host" address = "192.168.33.10" vars.customer = "icinga" } object Host "workshop-2" { import "generic-host" address = "192.168.33.20" vars.customer = "icinga" } object HostGroup "icinga" { assign where host.vars.customer == "icinga" } apply Service "http" { check_command = "http" vars.http_uri = "/icingaweb" groups += [ "icinga-http" ] assign where match("workshop*", host.name) } object ServiceGroup "icinga-http" { }
  • 16. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG NotificationNotification Icinga 2 Workshop template Notification "notify-mysql-users" { command = "mail-service-notification" states = [ OK, Warning, Critical, Unknown ] types = [ Problem, Acknowledgement, Recovery, Custom, FlappingStart, FlappingEnd, DowntimeStart, DowntimeEnd, DowntimeRemoved ] period = "24x7" user_groups = [ "icingaadmins" ] } apply Notification "mysql-status" to Service { import "notify-mysql-users" assign where match("*mysql*", service.check_command) ignore where services.vars.disable_mysql_notifications == true } apply Notification "notify-cust-icinga-mysql" to Service { import "cust-icinga-notification" assign where match("*mysql*", service.check_command) && host.vars.customer == "icinga" ignore where match("*internal", host.name) ignore where service.vars.sla != "24x7" }
  • 17. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG DependencyDependency Icinga 2 Workshop apply Service "nrpe-health" { import "generic-service" check_command = "nrpe" assign where host.vars.agent == "nrpe" } apply Service "nrpe-load" { import "generic-service" check_command = "nrpe" vars.nrpe_command = "check_load" assign where host.vars.agent == "nrpe" } apply Service "nrpe-disk" { import "generic-service" check_command = "nrpe" vars.nrpe_command = "check_disk" assign where host.vars.agent == "nrpe" } object Host "nrpe-server" { import "generic-host" address = "192.168.1.5" vars.agent = "nrpe" } apply Dependency "disable-nrpe-checks" to Service parent_service_name = "nrpe-health" states = [ OK ] disable_checks = true disable_notifications = true assign where service.check_command == "nrpe" && host.vars.agent == "nrpe" ignore where service.name == "nrpe-health" }
  • 19. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG Reconfigure to Master-MasterReconfigure to Master-Master • Wir lösen die Zone checker auf und nehmen icinga2b in die Master Zone auf • Icinga 2 auf beiden Seiten stoppen • Gecachte Cluster Daten löschen (beide Seiten) rm -rf /var/lib/icinga2/api/zones/* • zones.conf auf beiden Servern editieren • Inhalt von /etc/icinga2/zones.d/checker/ nach ../master/ verschieben • IDO HA Funktion deaktivieren • Icinga 2 wieder starten Icinga 2 Workshop # vim /etc/icinga2/features-enabled/ido-mysql.conf object IdoMysqlConnection "ido-mysql" { enable_ha = false } object Zone "master" { endpoints = [ "icinga2a", "icinga2b" ] }
  • 20. DEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORGDEV. WIKI. BLOG. DOC. | WWW.ICINGA.ORG QUESTIONS & ANSWERSQUESTIONS & ANSWERS Icinga 2 Workshop Web + Blog www.icinga.org Docs docs.icinga.org Development dev.icinga.org Sourcecode git.icinga.org Releases github.com/Icinga Wiki wiki.icinga.org IRC #icinga on FreeNode Mailing lists lists.icinga.org Support support.icinga.org Twitter twitter.com/icinga Facebook facebook.com/icinga …….. Everywhere! ? Questions & Answers