icinga camp belgrade - icinga 2 apify them all
TRANSCRIPT
• Michael Friedrich
• Icinga 2 Developer & Community Lead
• Senior Developer @NETWAYS
• ~7 years #icingalove
• @dnsmichi
ApiUser Object
# vim /etc/icinga2/conf.d/api-users.conf
object ApiUser "root" {
password = "icinga”
permissions = [ "*" ]
}
ApiUser Permissions
permissions = [
{
permission = "objects/query/Host"
filter = {{ regex("^Linux", host.vars.os) }}
},
{
permission = "objects/query/Service"
filter = {{ regex("^Linux", service.vars.os) }}
}
]
• create, modify and delete objects
• retrieve information and run actions
• subscribe to events
• manage configuration packages
• Configuration management
• New standard config API
• Support for Packages and Stages
• Support for Zones
• Used by the Icinga Director
• Event Streams
• Based on Types and Filters CheckResult, StateChange, Notification,
Acknowledgement*, Comment*, Downtime*
• Example /v1/events?queue=camp&types=CheckResult
• Status, Objects, Actions and Events
• Simple filter • services?service=localhost!ping6
• Advanced filter • type=Service&filter=service.name==%22ping6%22
• (Hint: assign where expressions)
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%"]
• Libraries
• python-icinga2api: https://pypi.python.org/pypi/python-icinga2api
• Management
• Foreman Smart Proxy: https://github.com/theforeman/smart_proxy_monitoring
• Status
• BitBar OSX: https://getbitbar.com/plugins/Dev/Icinga2/icinga2.24m.py
• Event Streams
• Logstash input: https://github.com/bobapple/logstash-input-icinga_eventstream
• Flapjack events: https://github.com/sol1/flapjack-icinga2
• Actions
• Lita handler: https://github.com/tuxmea/lita-icinga2
• Sakuli Forwarder: http://sakuli.readthedocs.io/en/dev/forwarder-icinga2api/
• mqttwarn: https://github.com/jpmens/mqttwarn#icinga2
• OpsGenie actions: https://www.opsgenie.com/docs/integrations/icinga2-integration
• Articles
• http://engineering.laterooms.com/taking-the-badger-to-icingard/
• https://issues.geant.net/jira/browse/PSCMON-111
• https://www.unixe.de/icinga2-dashing/
• Libraries
• Foreman, Puppet/Ansible/Chef Hook?
• Elastic/Logstash integration?
• Nagstamon, NagVis, …?
• Send a PR: https://github.com/Icinga/icinga2-api-examples
• Download Icinga 2
• Play with the Vagrant boxes
• Check the API docs
• Share your ideas & API clients