What is Advanced Excel and what are some best practices for designing and cre...
Ansible & Icinga 2 API
1. Ansible & Icinga 2 API
Configuration management and monitoring
@dan_vaida Berlin Ansible Meetup
2. Ansible & Icinga 2 API
Configuration management and monitoring
@dan_vaida Berlin Ansible Meetup
3. Icinga 2
• Advanced open-source monitoring solution
(forked from Nagios)
• Comes with rich CLI, REST API
• Encrypted cluster communication
• Supports MySQL or Postgres databases
@dan_vaida Berlin Ansible Meetup
4. Icinga 2 getting started
resources
• Ansible, Puppet & Chef provisioning
• Vagrant boxes (provisioned with Puppet)
• Docker container
• Great docs, active development and support
• Icinga Exchange: directory for Modules, Addons
and Plugins (i.e. Graphite & Grafana). Sort of like
Ansible Galaxy for roles.
@dan_vaida Berlin Ansible Meetup
5. My learnings from this
integration - pt. 1
• Ansible* can talk to the API through the shell or
uri modules (depends on the auth type)
• You’re still gonna have to do templating of some
of the .conf files
• The API is creating separate .conf files that are
merged in-memory upon service (re)start with
the “normal” .conf files
* Ansible 2+ is required for some nice params of the uri module
@dan_vaida Berlin Ansible Meetup
6. My learnings from this
integration - pt. 2
• The merging of the templated .conf files with the ones
resulting from the API calls is sometimes acting weird
• The API cannot handle configuration objects that
weren’t created through the API
• It’s production-ready but it’s still WIP (i.e. consistent
response structure, response code meaning, empty
response objects(!), value format checks)
• Don’t confuse Icinga API Users, Icinga Contacts/
Users and Icinga Web 2 Users
@dan_vaida Berlin Ansible Meetup
7. My learnings from this
integration - pt. 3
• Idempotence: consistent API response structure
and Ansible from_json filter make it easy to work
with changed_when and when conditionals
• Ansible makes it really easy to reuse the Icinga
API tasks by changing the HTTP Request Verb
(for example through —extra-vars)
• Incentivized to write an Ansible module for
interacting with the Icinga API
@dan_vaida Berlin Ansible Meetup
8. My learnings from this
integration - pt. 4
• With the help of Ansible and the Icinga RESTful
API, the Devs can and are finally coding
monitoring :)
• With just a few tasks in your deployment
playbooks one can simply and proactively ready
the monitoring system
• It’s easy to go crazy (HipChat -> Hubot -> Icinga
API -> PagerDuty)
@dan_vaida Berlin Ansible Meetup