icinga2 - upcoming api for icinga2

36
www.icinga.org Icinga 2: Apify them all Icinga Camp - Portland - 10/10/2015

Upload: icinga

Post on 16-Apr-2017

17.756 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Icinga2 - Upcoming API for Icinga2

www.icinga.org

Icinga 2: Apify them all

Icinga Camp - Portland - 10/10/2015

Page 2: Icinga2 - Upcoming API for Icinga2

• Michael Friedrich• Core Developer• 6+ years #icingalove

• @dnsmichi

Page 3: Icinga2 - Upcoming API for Icinga2

ICINGA 2: INTRODUCTION

Page 4: Icinga2 - Upcoming API for Icinga2

• Icinga 2 configuration DSL• Apply, conditions, functions, …

• Features (Graphite, DB IDO, …)• Standalone or Cluster with Clients• Already there – what’s missing?

Page 5: Icinga2 - Upcoming API for Icinga2

ICINGA 2: INTEGRATION

Page 6: Icinga2 - Upcoming API for Icinga2

• Many existing interfaces• Integration with other tools• Can they satisfy my requirements?

Page 7: Icinga2 - Upcoming API for Icinga2

• File based (status.dat, config files)• Database (IDO)• Unixsocket (Livestatus)• FIFO (External Command Pipe)

Page 8: Icinga2 - Upcoming API for Icinga2

ICINGA 2 API – UNIFY THEM ALL

Page 9: Icinga2 - Upcoming API for Icinga2

• Snmp traps as check results• Metrics as event streams• External command actions• Status Queries• Inventory: Use $tool to create objects

at runtime

Page 10: Icinga2 - Upcoming API for Icinga2

API – REQUIREMENTS

Page 11: Icinga2 - Upcoming API for Icinga2

• RESTful url schema• HTTP protocol, status codes• JSON for requests & responses• Version safety (/v1/…)• Url endpoints (/v1/status,

/v1/objects, …)

Page 12: Icinga2 - Upcoming API for Icinga2

{

"results": [

{

"code": 500.0,

"errors": [

"Error: Validation failed for object 'google.com' of type 'Host'; Attribute 'check_command': Attribute must not be empty."

],

"status": "Object could not be created."

}

]

}

Page 13: Icinga2 - Upcoming API for Icinga2

• Authentication & Authorization• HTTPS only via port 5665• Basic Auth and/or• Client certificates• Permissions (query, modify, actions,

…)

Page 14: Icinga2 - Upcoming API for Icinga2

API – USE CASES

Page 15: Icinga2 - Upcoming API for Icinga2

• Create, modify & delete objects• At runtime, no reload• Static Apply-Rules evaluated at

runtime• Dependency tracking of objects• Cluster zone sync

Page 16: Icinga2 - Upcoming API for Icinga2

curl -u root:icinga -k –s \

'https://localhost:5665/v1/objects/hosts/puppetlabs.com' \

-X PUT \

-d '{ "attrs": {

"address": "52.10.10.141”,

"check_command": "hostalive”,

"vars.os" : "Linux”

}

}'

Page 17: Icinga2 - Upcoming API for Icinga2

• Object Queries• Configuration & Status• Access e.g. command line from

checks• Filter by attributes (same filters as in

config DSL)• Implicit joins

Page 18: Icinga2 - Upcoming API for Icinga2

$ curl -u root:icinga -k -s 'https://localhost:5665

/v1/objects/hosts/puppetlabs.com'

Page 19: Icinga2 - Upcoming API for Icinga2

• Actions• Schedule downtimes• Reschedule checks• Acknowledge problems• Multiple objects w/ filters, e.g. all

services in a NOT-OK state

Page 20: Icinga2 - Upcoming API for Icinga2

$ curl -u root:icinga -k -s –X POST 'https://localhost:5665

/v1/actions/reschedule-check

?filter=service.state!=0

&type=Service'

Page 21: Icinga2 - Upcoming API for Icinga2

• Status• Global feature statistics• /v1/status

Page 22: Icinga2 - Upcoming API for Icinga2

$ curl -k -s -u root:icinga 'https://localhost:5665/v1/status'

Page 23: Icinga2 - Upcoming API for Icinga2

• Manage configuration packages• Stages & Validation• Active runtime stage• Direct file access over the API• Used by Icinga Web 2 Config Tool

Page 24: Icinga2 - Upcoming API for Icinga2

$ curl -k -s -u root:icinga -X POST \

https://localhost:5665/v1/config/packages/puppet

$ curl -k -s -u root:icinga -X POST \

https://localhost:5665/v1/config/stages/puppet \

-d '{

"files": {

"conf.d/test.conf": "object Host \"cfg-mgmt\" { check_command = \"dummy\" }”

}

}'

Page 25: Icinga2 - Upcoming API for Icinga2

• Event Streams• Subscribe to (filtered) core events• Forward data to external apps• Same filters as in config DSL• Work-in-progress

Page 26: Icinga2 - Upcoming API for Icinga2

2 API

Query, Create, Modify, Delete

ObjectsConfig

Packages

Status Actions Event Streams

Page 27: Icinga2 - Upcoming API for Icinga2

CALL TO ACTION

Page 28: Icinga2 - Upcoming API for Icinga2

Demo

Page 29: Icinga2 - Upcoming API for Icinga2

CONCLUSION

Page 30: Icinga2 - Upcoming API for Icinga2
Page 31: Icinga2 - Upcoming API for Icinga2
Page 32: Icinga2 - Upcoming API for Icinga2
Page 33: Icinga2 - Upcoming API for Icinga2
Page 34: Icinga2 - Upcoming API for Icinga2

• Open Tasks• Event Streams missing• History API in 2016 (?)

• v2.4 Release date: 11.11.2015• More at OSMC:

https://www.netways.de/en/events_trainings/osmc/program/

Page 36: Icinga2 - Upcoming API for Icinga2

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

@icinga/icinga+icinga