Icinga Module for AWS

by | Sep 17, 2019

Some say you have to move all of your server infrastructure into the cloud. Others counter that you should keep your data safe and secure in your own datacenter. And then there are many people in between who use cloud services as an addition to their self-hosted servers. In fact, there’s no right or wrong, because as always in IT: It depends. We at Icinga always try to find a way to make everyone happy with their monitoring – be it in the cloud or on premise. Today we’re pleased to announce version 1.0 of our Icinga Module for AWS!

Automation and integrations are important parts of every Icinga setup since ever then. The Icinga Module for AWS follows this path by embedding into your existing monitoring setup. The module is an addition for the well-known Icinga Director, whose main purpose is to manage Icinga configuration at a glance – the Icinga Module for AWS is yet another Director Import Source. Import sources are a crucial factor of the Director as they enable you to import data from multiple data providers. The collected data is transformed into Icinga 2 configuration. Learn more about import sources and automation in our guide Monitoring Automation with Icinga Director.

This module collects data about your EC2 Instances, RDS Instances, Load Balancers and Auto Scaling Groups. The Director uses the regularly collected information to create Icinga 2 configuration out of it. Since this can be automated, you can just continue on spawning and deleting new instances in AWS without having to take care about if they’re going to be monitored or not – without any human interaction.

Import EC2 Instances

The following example demonstrates how you can use this module to import details about your currently running EC2 Instances into Icinga. Before you get started, make sure you have your AWS Access Key by hand. This is required, so you can establish a connection to your account and pick up the information we need for monitoring. Make sure to add your Key details to the modules configuration at Configuration > Modules > aws > AWS Keys.

Installation and Configuration

Extract or clone this module to your Icinga Web 2 module path. The directory name must fit the module name, aws. This would usually lead to /usr/share/icingaweb2/modules/aws
Additionally, the module requires the AWS PHP SDK v3 which you have to install manually. The easiest way to do this is by downloading it from the release page and unpacking it into /usr/share/icingaweb2/modules/aws/library/vendor/aws

Configuring the Import Source

The first step is to create a new Director Import Source:

  • Import source name: A general identifier, choose something that you will recognise later
  • Source type: Select Aws module
  • AWS region: You may create an import source for each region you use
  • AWS access method: Select your previously configured AWS Key from the dropdown
  • Object type: We use EC2 Instances for this demo purpose, you may create multiple import jobs for each object type you want to import

Save the details and open the newly created Import Source again. We now continue with adding a Modifier.

 

Import only running Instances

Director Modifiers are used to handle the incoming data and transform it or filter it by certain conditions. Since you usually want to monitor only running instances, we’re using a Modifier to filter for the state of the EC2 Instances.

  • Property: We refer to the status property, in order to filter by states
  • Modifier: The Black or White-list modifier allows you to whitelist only certain instances
  • Filter: We filter by running systems only
  • Policy: Here we decide to keep only matching rows, therefore only running systems are whitelisted

Hit the save button to save your Modifier.

 

Trigger Import Run

You’re now ready to trigger the first import run. This will not create any Icinga configuration yet, but allow you to see a preview of the collected information in the “Preview” tab. There you can now see a variety of data that was synchronised from your AWS account. All of these information can be used to create Icinga hosts for example. Additionally you may use part of the data and add it as custom variables to your monitoring objects.

Your next step is to create a Sync Rule which will use the gathered AWS data to generate Icinga configuration. If you’re not familiar with Sync Rules, you may refer either to the Director Documentation to learn about it or read our guide Monitoring Automation with Icinga Director

You May Also Like…

Subscribe to our Newsletter

A monthly digest of the latest Icinga news, releases, articles and community topics.