icinga2 - upcoming api for icinga2

Post on 16-Apr-2017

17.756 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

www.icinga.org

Icinga 2: Apify them all

Icinga Camp - Portland - 10/10/2015

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

• @dnsmichi

ICINGA 2: INTRODUCTION

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

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

ICINGA 2: INTEGRATION

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

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

ICINGA 2 API – UNIFY THEM ALL

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

at runtime

API – REQUIREMENTS

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

/v1/objects, …)

{

"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."

}

]

}

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

…)

API – USE CASES

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

runtime• Dependency tracking of objects• Cluster zone sync

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”

}

}'

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

checks• Filter by attributes (same filters as in

config DSL)• Implicit joins

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

/v1/objects/hosts/puppetlabs.com'

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

services in a NOT-OK state

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

/v1/actions/reschedule-check

?filter=service.state!=0

&type=Service'

• Status• Global feature statistics• /v1/status

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

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

$ 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\" }”

}

}'

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

2 API

Query, Create, Modify, Delete

ObjectsConfig

Packages

Status Actions Event Streams

CALL TO ACTION

Demo

CONCLUSION

• 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/

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

@icinga/icinga+icinga

top related