Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g...

29
Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Config Management & Orchestration Monitoring Extending Examples The End Spoiler Icinga2 : Beyond Monitoring More than monitoring and metrics Toshaan Bharvani - VanTosh bvba <[email protected]> OSAD Mi¨ unich 2019 16 October 2019 Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 1 / 29

Transcript of Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g...

Page 1: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Icinga2 : Beyond MonitoringMore than monitoring and metrics

Toshaan Bharvani - VanTosh bvba

<[email protected]>

OSAD Miunich 2019

16 October 2019

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 1 / 29

Page 2: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

$ whoami

Toshaan Bharvani - VanTosh

• From Antwerp, Belgium

• Self-employed engineer, trainer, consultant,http://www.vantosh.com

• Involved with Enterprise OS : PEL, RHEL, CentOS, IBM AIX,OpenBSD, FreeBSD, SLES, . . .

• Likes to keep everything secure : SELinux, WebSec, . . .

• Lives in a virtual world : KVM, Xen, LXC, PowerVM, z/VM, . . .

• Likes automation CfgMgmt / DevOps : Ansible, Foreman,Puppet, Mosquitto

• Works on both hardware and software side

• Wants to take over the universe

• Twitter : @toshywoshy

• Blog : http://www.toshaan.com

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 2 / 29

Page 3: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Table of contents

1 Config Management & Orchestration

2 Monitoring

3 Extending

4 Examples

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 3 / 29

Page 4: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

1

Config Management & Orchestration

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 4 / 29

Page 5: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Ansible

• Orchestration / CfgMgmt / Remote Execution Tool

• Python based uses SSH, WinRM, or API

• Server based, agentless1

• host information in flat files, CMDB, scripts, . . .

• executes the task on the host side

• Playbook : combination of tasks with meta information

• Roles : abstract playbook with tasks, variables and handlers

• Templates : Jinja2

• works where Python works2

1Abstraction of SSH / WinRM to connect with the node and in certain setup an agent might be required, but by default it is

not necessary2

Ansible can actually run without Python on the remote host, however it is not fully supported

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 5 / 29

Page 6: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Foreman

Foreman is a complete lifecycle management tool for physical andvirtual servers. We give system administrators the power to easilyautom ¡oy applications, and proactively manage servers, on-premise orin the cloud.

• Automate, discover, provision and upgrade infrastructure

• Ruby on Rails

• Can integrate with Puppet, Chef, Salt, Ansible, . . .

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 6 / 29

Page 7: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

2

Monitoring

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 7 / 29

Page 8: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Icinga2

Monitoring

Graphing

Dashboard

Alert

Notifications

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 8 / 29

Page 9: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Monitoring

• Checks the current state of a subject

• Checks the current utilization of a subject

• Checks the current return of a subject

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 9 / 29

Page 10: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Metrics

• Measures and keeps the history of the states of a subject

• Measures and keeps the history of the utilization of a subject

• Measures and keeps the history of the return of a subject

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 10 / 29

Page 11: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Hosts & Services

• Hosts

• Bare Metal Machine

• Virtual Machine

• Services

• Application

• Database

• State or return value

• Process

• Database Cluster

• Web Cluster

• Loadbalancers

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 11 / 29

Page 12: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Notifications & Alerts

• Notification

• Informataion of problem

• Self remediation

• Alert

• Failure

• End user impact

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 12 / 29

Page 13: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 13 / 29

Page 14: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

3

Extending

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 14 / 29

Page 15: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Icinga2 Extentions

� �1 object NotificationCommand "service -notification -playbook" {2 import "plugin -notification -command"3 command = [ SysconfDir + "/icinga2/scripts/run -ansible -playbook.sh" ]4 env = {5 NOTIFICATIONTYPE = "$notification.type$"6 SERVICEDESC = "$service.name$"7 HOSTALIAS = "$host.display_name$"8 HOSTADDRESS = "$address$"9 SERVICESTATE = "$service.state$"

10 LONGDATETIME = "$icinga.long_date_time$"11 SERVICEOUTPUT = "$service.output$"12 NOTIFICATIONAUTHORNAME = "$notification.author$"13 NOTIFICATIONCOMMENT = "$notification.comment$"14 HOSTDISPLAYNAME = "$host.display_name$"15 SERVICEDISPLAYNAME = "$service.display_name$"16 USEREMAIL = "$user.email$"17 }18 }1920 apply Notification "host -notification" to Host {21 command = "service -notification -mail"22 users = [ "user1", "user2" ]23 period = "24x7"24 states = [ OK, Warning , Critical , Unknown ]25 types = [ Problem , Recovery ]26 assign where host.vars.notify_host == true27 }2829 apply Notification "service -notification" to Service {30 command = "service -notification -mail"31 users = [ "user1", "user3" ]32 period = "24x7"33 states = [ OK, Warning , Critical , Unknown ]34 types = [ Problem , Acknowledgement , Recovery ]35 assign where service.vars.notify_service == true36 }� �

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 15 / 29

Page 16: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Ansible Extentions

• Icinga2 connects to Ansible Bastion to run playbook

• The Icinga2 ssh user can execute playbooks

• � �1 ansible -playbook ~/. ansible/playbook/repairmariadbcluster.yml -e ’host=db3’� �• � �

1 ansible -playbook ~/. ansible/playbook/vm-install.yml -e ’host=newvm0 ’� �• � �

1 ansible -playbook ~/. ansible/playbook/repairloadbalancer.yml -l lbweb8� �

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 16 / 29

Page 17: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

4

Examples

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 17 / 29

Page 18: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Load Balancer (0)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 18 / 29

Page 19: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Load Balancer (1)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 19 / 29

Page 20: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Load Balancer (2)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 20 / 29

Page 21: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Load Balancer (3)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 21 / 29

Page 22: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Load Balancer (4)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 22 / 29

Page 23: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

Load Balancer (5)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 23 / 29

Page 24: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

DB Cluster Repair (0)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 24 / 29

Page 25: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

DB Cluster Repair (1)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 25 / 29

Page 26: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

DB Cluster Repair (2)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 26 / 29

Page 27: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

DB Cluster Repair (3)

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 27 / 29

Page 28: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

The End

Thank You

Toshaan Bharvani - VanTosh bvba <[email protected]>

http://www.vantosh.com/

Made with Beamer LATEXa TEXbased Presentation program

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 28 / 29

Page 29: Icinga2 : Beyond Monitoring · Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba Con g Management & Orchestration Monitoring Extending Examples The End Spoiler Foreman Foreman

Icinga2 :Beyond

Monitoring

ToshaanBharvani -

VanTosh bvba

ConfigManagement &Orchestration

Monitoring

Extending

Examples

The End

Spoiler

CfgMgmtCamp 2020

3 → 5 February 2020

https://cfgmgmtcamp.eu/

Icinga2 : Beyond Monitoring Toshaan Bharvani - VanTosh bvba () 29 / 29