One of the biggest advantages of Icinga is its capability to interact with other tools. Integrations of Icinga cover notification mechanisms, visualisations or automatic deployment. Especially our REST API allows users to easily connect with Icinga, be it for read access or the creation of new objects.The possibility to automate allows Icinga users to monitor highly dynamical infrastructure in private and public clouds.
One outstanding tool that leverages the Icinga API to automate the monitoring configuration is HashiCorp Terraform.. Terraform provides a consistent workflow using infrastructure as code to provision any cloud, infrastructure, or service. Operators codify infrastructure to safely and efficiently provision and manage infrastructure at any scale.. Terraform applies this consistent workflow across multiple providers, such as AWS, Microsoft Azure, Google Cloud Platform, OpenStack or even directly to bare metal servers, while still preserving the uniqueness of each provider.. HashiCorp Terraform is offered as both an open source tool and available as an enterprise solution for organizations that require more help with collaboration and governance across teams. Some of the other well known tools available from HashiCorp include Vagrant, Vault and Consul.
The Icinga integration for Terraform empowers users to automatically add new monitoring configurations as the infrastructure grows. Today I am delighted to announce that Icinga officially joined the HashiCorp Technology Partner Program!
Terraform Icinga 2 Provider
Providers for Terraform extend the capabilities of Terraform. A provider understands a certain API, usually of a IaaS, PaaS, or SaaS platform, and exposes its resources. The Icinga 2 provider for Terraform can create new hosts, host groups, services and check commands through the Icinga 2 REST API
Let’s say you are running your infrastructure on Azure. Every time you create a new host, you would call the Icinga 2 provider to create the host in your monitoring environment as well. Resulting in a fully monitored environment, with almost zero additional effort:
provider "icinga2" { api_url = "https://127.0.0.14:5665/v1" } resource "icinga2_host" "host" { hostname = "azure-host-1" address = "10.0.10.15" check_command = "hostalive" templates = ["terraform-azure-host"] vars { os = "linux" } }
Did you know you can use custom variables to automatically apply service checks to your hosts? The Icinga 2 DSL allows you to do exactly that. Let’s suppose your instances are now automatically created and now you want to “Monitor SSH on every Linux Host”.
With the following Icinga 2 configuration that’s pretty easy to achieve:
apply Service "ssh" { check_command = "ssh" assign where host.vars.os = 'linux' }
This is a very basic example, learn more about the power of apply rules and how they help you automate your entire monitoring configuration in our docs.