Successfully reported this slideshow.

Icinga 2 API @ Icinga Camp Portland at Puppetlabs

1

Share

Loading in …3
×
1 of 36
1 of 36

Icinga 2 API @ Icinga Camp Portland at Puppetlabs

1

Share

Download to read offline

Current state of development of the upcoming Icinga 2.4 unifying all interfaces into a general REST API. Includes demo snippets for AWS and Dashing integrations.

Current state of development of the upcoming Icinga 2.4 unifying all interfaces into a general REST API. Includes demo snippets for AWS and Dashing integrations.

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Icinga 2 API @ Icinga Camp Portland at Puppetlabs

  1. 1. www.icinga.org Icinga 2: Apify them all Icinga Camp - Portland - 10/10/2015
  2. 2. •  Michael Friedrich •  Core Developer •  6+ years #icingalove •  @dnsmichi
  3. 3. ICINGA 2: INTRODUCTION
  4. 4. •  Icinga 2 configuration DSL •  Apply, conditions, functions, … •  Features (Graphite, DB IDO, …) •  Standalone or Cluster with Clients •  Already there – what’s missing?
  5. 5. ICINGA 2: INTEGRATION
  6. 6. •  Many existing interfaces •  Integration with other tools •  Can they satisfy my requirements?
  7. 7. •  File based (status.dat, config files) •  Database (IDO) •  Unixsocket (Livestatus) •  FIFO (External Command Pipe)
  8. 8. ICINGA 2 API – UNIFY THEM ALL
  9. 9. •  Snmp traps as check results •  Metrics as event streams •  External command actions •  Status Queries •  Inventory: Use $tool to create objects at runtime
  10. 10. API – REQUIREMENTS
  11. 11. •  RESTful url schema •  HTTP protocol, status codes •  JSON for requests & responses •  Version safety (/v1/…) •  Url endpoints (/v1/status, /v1/ objects, …)
  12. 12. { "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." } ] }
  13. 13. •  Authentication & Authorization •  HTTPS only via port 5665 •  Basic Auth and/or •  Client certificates •  Permissions (query, modify, actions, …)
  14. 14. API – USE CASES
  15. 15. •  Create, modify & delete objects •  At runtime, no reload •  Static Apply-Rules evaluated at runtime •  Dependency tracking of objects •  Cluster zone sync
  16. 16. 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” } }'
  17. 17. •  Object Queries •  Configuration & Status •  Access e.g. command line from checks •  Filter by attributes (same filters as in config DSL) •  Implicit joins
  18. 18. $ curl -u root:icinga -k -s 'https:// localhost:5665 /v1/objects/hosts/puppetlabs.com'
  19. 19. •  Actions •  Schedule downtimes •  Reschedule checks •  Acknowledge problems •  Multiple objects w/ filters, e.g. all services in a NOT-OK state
  20. 20. $ curl -u root:icinga -k -s –X POST 'https:// localhost:5665 /v1/actions/reschedule-check ?filter=service.state!=0 &type=Service'
  21. 21. •  Status •  Global feature statistics •  /v1/status
  22. 22. $ curl -k -s -u root:icinga 'https:// localhost:5665/v1/status'
  23. 23. •  Manage configuration packages •  Stages & Validation •  Active runtime stage •  Direct file access over the API •  Used by Icinga Web 2 Config Tool
  24. 24. $ 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" }” } }'
  25. 25. •  Event Streams •  Subscribe to (filtered) core events •  Forward data to external apps •  Same filters as in config DSL •  Work-in-progress
  26. 26. 2 API Query, Create, Modify, Delete Objects Config Packages Status Actions Event Streams
  27. 27. CALL TO ACTION
  28. 28. Demo
  29. 29. CONCLUSION
  30. 30. •  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/
  31. 31. •  Install Icinga 2 snapshot packages •  Docker, Vagrant •  http://docs.icinga.org/icinga2/snapshot/doc/module/ icinga2/chapter/icinga2-api#icinga2-api •  Connect to https://localhost:5665/v1/status
  32. 32. THANK YOU! www.icinga.org dev.icinga.org git.icinga.org @icinga /icinga +icinga

×