icinga camp san diego: apify them all
TRANSCRIPT
![Page 1: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/1.jpg)
www.icinga.org
#icingacamp – San Diego – 10/18/2016
ICINGA 2 – APIFY THEM ALL
![Page 2: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/2.jpg)
• Michael Friedrich
• Icinga 2 Developer & Community Lead
• Senior Developer @NETWAYS
• 7+ years #icingalove
• @dnsmichi
![Page 3: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/3.jpg)
ICINGA 2 - API
![Page 4: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/4.jpg)
• HTTP with RESTful Url Schema
• ApiUser config object
• X.509 and/or Basic Auth
![Page 5: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/5.jpg)
ApiUser Object
object ApiUser "root" {
password = "icinga”
permissions = [ "*" ]
}
![Page 6: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/6.jpg)
ApiUser Permissions
permissions = [
{
permission = "objects/query/Host"
filter = {{ regex("^Linux", host.vars.os) }}
},
{
permission = "objects/query/Service"
filter = {{ regex("^Linux", host.vars.os) }}
}
]
![Page 7: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/7.jpg)
• create, modify and delete objects
• query objects and status
• run actions
• subscribe to events
• manage configuration packages
![Page 8: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/8.jpg)
• Status, Objects, Actions and Events
• Simple filterservices?service=localhost!ping6
• Advanced filtertype=Service&filter=service.name==%22ping6%22
(Hint: assign where expressions)
![Page 9: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/9.jpg)
• Configuration management
• New standard config API
• Support for Packages and Stages
• No more SSH transport, all HTTP
• Used by the Icinga Director
![Page 10: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/10.jpg)
• Event Streams• Based on types
CheckResult, StateChange, Notification, Acknowledgement*, Comment*, Downtime*
• Use filtersExample: Receive all check results where the state is not OK.
$ curl -k -s -u root:icinga -H 'Accept: application/json' -X POST \'https://192.168.33.5:5665/v1/events' \
-d '{ "queue": "mine", "types": [ "CheckResult" ], "filter":
"event.check_result.state != 0" }'
![Page 11: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/11.jpg)
Demo
![Page 12: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/12.jpg)
API CLIENTS
![Page 13: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/13.jpg)
Icinga Studio
![Page 14: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/14.jpg)
Icinga 2 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%"
]
![Page 15: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/15.jpg)
Icinga 2 Dashing
![Page 16: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/16.jpg)
Icinga Director
![Page 17: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/17.jpg)
Bitbar for OSX
![Page 18: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/18.jpg)
aNag for Android
![Page 19: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/19.jpg)
Programmatic examples: Event Streams
![Page 20: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/20.jpg)
Paw for MacOS
![Page 21: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/21.jpg)
ICINGA 2 API – COMMUNITY
![Page 22: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/22.jpg)
• Libraries
• python-icinga2api: https://pypi.python.org/pypi/python-icinga2api
• go-icinga2: https://github.com/xert/go-icinga2
• Management
• Foreman Smart Proxy: https://github.com/theforeman/smart_proxy_monitoring
• Terraform Provider: https://github.com/lrsmith/terraform-provider-icinga2
![Page 23: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/23.jpg)
• Status
• Grafana Plugin: https://github.com/tegud/grafana-icinga2api
• aNag on Android: https://damien.degois.info/android/aNag/summary
• 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
![Page 24: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/24.jpg)
• 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
![Page 25: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/25.jpg)
ICINGA 2 API – WHAT’S NEXT?
![Page 26: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/26.jpg)
• More libraries
• Elastic Beats integration
• Puppet/Ansible/Chef/Salt Hook
• Nagstamon, NagVis, …
• Send a PR: https://github.com/Icinga/icinga2-api-examples
![Page 27: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/27.jpg)
CONCLUSION
![Page 28: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/28.jpg)
• Download Icinga 2
• Play with the Vagrant boxes
• Check the API docs
• Share your ideas & API clients
![Page 29: Icinga Camp San Diego: Apify them all](https://reader033.vdocuments.mx/reader033/viewer/2022052606/587737ab1a28ab342e8b4e7d/html5/thumbnails/29.jpg)
THANK YOU!www.icinga.org
dev.icinga.org
git.icinga.org
@icinga
/icinga
+icinga