WWWWWW..IICCIINNGGAA..OORRGG 
Icinga 2 
Hacking Session 
Icinga 2 Workshop 
2014-10-10
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
AAggeennddaa 
• Icinga Cluster VMs 
• A look on the config 
• Configuration & Practice 
• Cluster reconfiguration 
• Questions & Answers 
Icinga 2 Workshop
CClluusstteerr VVMMss
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
CClluusstteerr VVMMss 
Icinga 2 Workshop
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
CClluusstteerr VVMMss 
Icinga 2 Workshop
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
CClluusstteerr VVMMss 
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 
Icinga 2 Workshop
CCoonnffiigguurraattiioonn
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
IImmppoorrttaanntt PPaatthhss 
/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 
Icinga 2 Workshop
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
DDeemmoo 
Icinga 2 Workshop 
DEMO
Configuration && pprraaccttiiccee
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
HHoosstt // HHoossttggrroouupp // SSeerrvviiccee 
object Host "mysql-db1" { 
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) 
Icinga 2 Workshop 
} 
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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
CCuussttoomm cchheecckk ccoommmmaannddss 
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" 
Icinga 2 Workshop 
} 
} 
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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
CCuussttoomm cchheecckk ccoommmmaannddss 
template Host "mysql-server" { 
check_interval = 3m 
vars.mysql_port = 3306 
Icinga 2 Workshop 
} 
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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
PPrraaccttiiccee 
• 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
PPrraaccttiiccee ssoolluuttiioonn 
object Host "workshop-1" { 
import "generic-host" 
address = "192.168.33.10" 
vars.customer = "icinga" 
Icinga 2 Workshop 
} 
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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
NNoottiiffiiccaattiioonn 
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" ] 
Icinga 2 Workshop 
} 
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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
DDeeppeennddeennccyy 
apply Service "nrpe-health" { 
import "generic-service" 
check_command = "nrpe" 
assign where host.vars.agent == "nrpe" 
Icinga 2 Workshop 
} 
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" 
}
RReeccoonnffiigguurree CClluusstteerr
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
RReeccoonnffiigguurree ttoo MMaasstteerr--MMaasstteerr 
• 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 
# vim /etc/icinga2/features-enabled/ido-mysql.conf 
object IdoMysqlConnection "ido-mysql" { 
enable_ha = false 
Icinga 2 Workshop 
} 
object Zone "master" { 
endpoints = [ "icinga2a", "icinga2b" ] 
}
DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG 
QQUUEESSTTIIOONNSS && AANNSSWWEERRSS 
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

PPTX
Sapphire Gimlets
PPTX
Guice gin
PDF
Troubleshooting JIRA & Confluence
PDF
Integrating icinga2 and the HashiCorp suite
PPTX
Coolblue - Behind the Scenes Continuous Integration & Deployment
PDF
MySQL document_store
PDF
Design & Performance - Steve Souders at Fastly Altitude 2015
PDF
Get Gulping with Javascript Task Runners
Sapphire Gimlets
Guice gin
Troubleshooting JIRA & Confluence
Integrating icinga2 and the HashiCorp suite
Coolblue - Behind the Scenes Continuous Integration & Deployment
MySQL document_store
Design & Performance - Steve Souders at Fastly Altitude 2015
Get Gulping with Javascript Task Runners

What's hot (20)

PDF
Manchester Hadoop Meetup: Cassandra Spark internals
KEY
Effective iOS Network Programming Techniques
PDF
A quick tour of Mysql 8 roles
PDF
Nginx3
PDF
“warpdrive”, making Python web application deployment magically easy.
PDF
Everybody Loves AFNetworking ... and So Can you!
PDF
Icinga 2 and Puppet - Automate Monitoring
PDF
Service worker: discover the next web game changer
PDF
Icinga 2 and puppet: automate monitoring
KEY
Taking a Test Drive
PDF
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
PPTX
Bucks County Tech Meetup: node.js introduction
PDF
Working with AFNetworking
PDF
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
PDF
Knex Postgresql Migration
PPTX
Gradle basics
PDF
Get Grulping with JavaScript Task Runners
PPTX
Java script at backend nodejs
PDF
Get Grulping with JavaScript Task Runners (Matt Gifford)
PPTX
Sergey Dzyuban ''Cooking the Cake for Nuget packages"
Manchester Hadoop Meetup: Cassandra Spark internals
Effective iOS Network Programming Techniques
A quick tour of Mysql 8 roles
Nginx3
“warpdrive”, making Python web application deployment magically easy.
Everybody Loves AFNetworking ... and So Can you!
Icinga 2 and Puppet - Automate Monitoring
Service worker: discover the next web game changer
Icinga 2 and puppet: automate monitoring
Taking a Test Drive
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
Bucks County Tech Meetup: node.js introduction
Working with AFNetworking
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Morocco 2019
Knex Postgresql Migration
Gradle basics
Get Grulping with JavaScript Task Runners
Java script at backend nodejs
Get Grulping with JavaScript Task Runners (Matt Gifford)
Sergey Dzyuban ''Cooking the Cake for Nuget packages"

Viewers also liked (20)

PDF
Open Source Backup Conference 2014: Bareos in scientific environments, by Jan...
PDF
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
PDF
OSMC 2014: Naemon 1, 2, 3, N | Andreas Ericsson
PDF
Puppet Camp Berlin 2015: Felix Frank | Rapid Testing Setups for Puppet
PDF
Puppet Camp Duesseldorf 2014: Thomas Gelf - Puppet CA: certificates explained
PDF
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
PDF
Puppet Camp Duesseldorf 2014: Luke Kanies - Puppet Keynote
PDF
OpenNebula Conf 2014 | Lightning talk: Cloud in a box - Megam by Varadarajan ...
PDF
OpenNebula Conf 2014 | Bootstrapping a virtual infrastructure using OpenNebul...
PDF
OpenNebula Conf 2014 | State and future of OpenNebula - Ignacio Llorente
PDF
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
PDF
OpenNebula Conf 2014 | Using Ceph to provide scalable storage for OpenNebula ...
PDF
OSDC 2015: Bernd Ahlers | What is your configuration management system doing?
PDF
OSDC 2015: Nigel kersten | In Defense of Data Centers
PDF
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
PDF
OSDC 2015: Bernd Mathiske | Why the Datacenter Needs an Operating System
PDF
OSDC 2015: James Fryman | DevOps Next Steps: Event Driven Operation
PDF
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
PDF
OSDC 2015: David Norton | InfluxDB - Scalable Metrics Made Easy
PDF
OSDC 2014: Christian Kniep - Understand your data center by overlaying multi...
Open Source Backup Conference 2014: Bareos in scientific environments, by Jan...
OSMC 2014: Server Hardware Monitoring done right | Werner Fischer
OSMC 2014: Naemon 1, 2, 3, N | Andreas Ericsson
Puppet Camp Berlin 2015: Felix Frank | Rapid Testing Setups for Puppet
Puppet Camp Duesseldorf 2014: Thomas Gelf - Puppet CA: certificates explained
Puppet Camp Duesseldorf 2014: Toni Schmidbauer - Continuously deliver your pu...
Puppet Camp Duesseldorf 2014: Luke Kanies - Puppet Keynote
OpenNebula Conf 2014 | Lightning talk: Cloud in a box - Megam by Varadarajan ...
OpenNebula Conf 2014 | Bootstrapping a virtual infrastructure using OpenNebul...
OpenNebula Conf 2014 | State and future of OpenNebula - Ignacio Llorente
OpenNebula Conf 2014: CentOS, QA an OpenNebula - Christoph Galuschka
OpenNebula Conf 2014 | Using Ceph to provide scalable storage for OpenNebula ...
OSDC 2015: Bernd Ahlers | What is your configuration management system doing?
OSDC 2015: Nigel kersten | In Defense of Data Centers
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
OSDC 2015: Bernd Mathiske | Why the Datacenter Needs an Operating System
OSDC 2015: James Fryman | DevOps Next Steps: Event Driven Operation
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: David Norton | InfluxDB - Scalable Metrics Made Easy
OSDC 2014: Christian Kniep - Understand your data center by overlaying multi...

Similar to Icinga Workshop 2014 Icinga 2 Hacking Session (20)

PDF
Icinga2 Hacking Session 2014-10-10
PPTX
Icinga 2 at Icinga Camp San Francisco
PDF
What is new in icinga2
PDF
Why favour Icinga over Nagios @ FrOSCon 2015
PDF
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
PPTX
Monitoring as code
PPTX
Icinga Camp Antwerp - Icinga2 Configuration
PDF
Why favour Icinga over Nagios @ OSDC 2015
ODP
Integrating icinga2 and the HashiCorp suite
PPTX
State of Icinga - Linux Stammtisch München
PPTX
Icinga lsm 2015 copy
PDF
Icinga 2 @ SIG-NOC Meeting
PPTX
Icinga2 - Apify them all
PDF
Beyond Puppet
PDF
Icinga 1, Icinga 2 @ FrOSCon 2014
PDF
OSMC 2014: Current state of Icinga | Icinga Team
PDF
OSMC 2014 | Curret State of Icinga by Icinga Team
PDF
OSMC 2021 | Still directing the director… and more!
PDF
Puppet @ Seat
PPTX
Icinga @ OSMC 2014
Icinga2 Hacking Session 2014-10-10
Icinga 2 at Icinga Camp San Francisco
What is new in icinga2
Why favour Icinga over Nagios @ FrOSCon 2015
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
Monitoring as code
Icinga Camp Antwerp - Icinga2 Configuration
Why favour Icinga over Nagios @ OSDC 2015
Integrating icinga2 and the HashiCorp suite
State of Icinga - Linux Stammtisch München
Icinga lsm 2015 copy
Icinga 2 @ SIG-NOC Meeting
Icinga2 - Apify them all
Beyond Puppet
Icinga 1, Icinga 2 @ FrOSCon 2014
OSMC 2014: Current state of Icinga | Icinga Team
OSMC 2014 | Curret State of Icinga by Icinga Team
OSMC 2021 | Still directing the director… and more!
Puppet @ Seat
Icinga @ OSMC 2014

Recently uploaded (20)

PDF
Microsoft Office 365 Crack Download Free
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
most interesting chapter in the world ppt
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PPTX
Download Adobe Photoshop Crack 2025 Free
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Workplace Software and Skills - OpenStax
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PPTX
Computer Software - Technology and Livelihood Education
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
Topaz Photo AI Crack New Download (Latest 2025)
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PPTX
Lecture 5 Software Requirement Engineering
Microsoft Office 365 Crack Download Free
Wondershare Recoverit Full Crack New Version (Latest 2025)
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Tech Workshop Escape Room Tech Workshop
most interesting chapter in the world ppt
BoxLang Dynamic AWS Lambda - Japan Edition
Download Adobe Photoshop Crack 2025 Free
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
MCP Security Tutorial - Beginner to Advanced
Workplace Software and Skills - OpenStax
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
Computer Software - Technology and Livelihood Education
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Topaz Photo AI Crack New Download (Latest 2025)
How to Use SharePoint as an ISO-Compliant Document Management System
iTop VPN Crack Latest Version Full Key 2025
Full-Stack Developer Courses That Actually Land You Jobs
Lecture 5 Software Requirement Engineering

Icinga Workshop 2014 Icinga 2 Hacking Session

  • 1. WWWWWW..IICCIINNGGAA..OORRGG Icinga 2 Hacking Session Icinga 2 Workshop 2014-10-10
  • 2. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG AAggeennddaa • Icinga Cluster VMs • A look on the config • Configuration & Practice • Cluster reconfiguration • Questions & Answers Icinga 2 Workshop
  • 4. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG CClluusstteerr VVMMss Icinga 2 Workshop
  • 5. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG CClluusstteerr VVMMss Icinga 2 Workshop
  • 6. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG CClluusstteerr VVMMss 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 Icinga 2 Workshop
  • 8. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG IImmppoorrttaanntt PPaatthhss /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 Icinga 2 Workshop
  • 9. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG DDeemmoo Icinga 2 Workshop DEMO
  • 11. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG HHoosstt // HHoossttggrroouupp // SSeerrvviiccee object Host "mysql-db1" { 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) Icinga 2 Workshop } 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG CCuussttoomm cchheecckk ccoommmmaannddss 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" Icinga 2 Workshop } } 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG CCuussttoomm cchheecckk ccoommmmaannddss template Host "mysql-server" { check_interval = 3m vars.mysql_port = 3306 Icinga 2 Workshop } 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG PPrraaccttiiccee • 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG PPrraaccttiiccee ssoolluuttiioonn object Host "workshop-1" { import "generic-host" address = "192.168.33.10" vars.customer = "icinga" Icinga 2 Workshop } 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG NNoottiiffiiccaattiioonn 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" ] Icinga 2 Workshop } 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG DDeeppeennddeennccyy apply Service "nrpe-health" { import "generic-service" check_command = "nrpe" assign where host.vars.agent == "nrpe" Icinga 2 Workshop } 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. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG RReeccoonnffiigguurree ttoo MMaasstteerr--MMaasstteerr • 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 # vim /etc/icinga2/features-enabled/ido-mysql.conf object IdoMysqlConnection "ido-mysql" { enable_ha = false Icinga 2 Workshop } object Zone "master" { endpoints = [ "icinga2a", "icinga2b" ] }
  • 20. DEV. WIKI. BLOG. DDOOCC.. || WWWWWW..IICCIINNGGAA..OORRGG QQUUEESSTTIIOONNSS && AANNSSWWEERRSS 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