icinga2 - apify them all

22
www.icinga.org #icingacamp – Berlin – 03/01/2016 ICINGA 2 – APIFY THEM ALL

Upload: icinga

Post on 16-Apr-2017

8.300 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Icinga2 - Apify them all

www.icinga.org

#icingacamp – Berlin – 03/01/2016

ICINGA 2 – APIFY THEM ALL

Page 2: Icinga2 - Apify them all

• Michael Friedrich• Core developer, Vagrant boxes• Senior Developer @NETWAYS• ~7 years #icingalove• monitoring-portal.org

• @dnsmichi

Page 3: Icinga2 - Apify them all

ICINGA2 - API

Page 4: Icinga2 - Apify them all

We had “APIs”

Page 5: Icinga2 - Apify them all

• HTTP with RESTful Url Schema • ApiUser config object• X.509 and/or Basic Auth

Page 6: Icinga2 - Apify them all

ApiUser Object

# vim /etc/icinga2/conf.d/api-users.conf

object ApiUser "root" {

password = "icinga”

permissions = [ "*" ]

}

Page 7: Icinga2 - Apify them all

ApiUser Permissions

permissions = [

{

permission = "objects/query/Host"

filter = {{ regex("^Linux", host.vars.os) }}

},

{

permission = "objects/query/Service"

filter = {{ regex("^Linux", service.vars.os) }}

}

]

Page 8: Icinga2 - Apify them all

• create, modify and delete objects• retrieve information and run actions• subscribe to events• manage configuration packages

Page 9: Icinga2 - Apify them all

• Configuration management• New standard config API • Support for Packages and Stages• Support for Zones• Used by the Icinga Director

Page 10: Icinga2 - Apify them all

• Event Streams• Based on Types and Filters

CheckResult, StateChange, Notification, Acknowledgement*, Comment*, Downtime*

• Example/v1/events?queue=camp&types=CheckResult

Page 11: Icinga2 - Apify them all

• Status, Objects, Actions and Events• Simple filter

• services?service=localhost!ping6

• Advanced filter• type=Service&filter=service.name==%22ping6%22• (Hint: assign where expressions)

Page 12: Icinga2 - Apify them all

Demo

Page 13: Icinga2 - Apify them all

API CLIENTS

Page 14: Icinga2 - Apify them all

Icinga Studio

Page 15: Icinga2 - Apify them all

Icinga2 console

# ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/' --eval 'get_host(NodeName).last_check_result.command' | python -m json.tool

[ "/usr/lib64/nagios/plugins/check_ping", "-H", "127.0.0.1", "-c", "5000,100%", "-w", "3000,80%"]

Page 16: Icinga2 - Apify them all

Icinga 2 Dashing

Page 17: Icinga2 - Apify them all

Icinga Director

Wait for Tom!

Page 18: Icinga2 - Apify them all

ICINGA 2 API – WHAT’S NEXT?

Page 19: Icinga2 - Apify them all

• Libraries• Foreman, Puppet Hook?• Logstash integration?• Nagstamon, NagVis, …?• Send a PR:

https://github.com/Icinga/icinga2-api-examples

Page 20: Icinga2 - Apify them all

CONCLUSION

Page 21: Icinga2 - Apify them all

• Download Icinga 2• Play with the Vagrant boxes• Check the API docs• Share your ideas & API clients

Page 22: Icinga2 - Apify them all

THANK YOU!www.icinga.orgdev.icinga.orggit.icinga.org

@icinga/icinga+icinga