Use Autodiscovery to monitor AWS EC2 instances
In this tutorial, we will use the Autodiscovery module to detect AWS EC2 instances and monitor them.
Prerequisites
You must have:
- the credentials to the AWS group of instances you want to monitor (Name, AWS Access Key and AWS Secret Key)
- the region your AWS instances are in.
Step 1: Installing the Amazon EC2 plugin
-
Make sure your commercial license or your free IT-100 license is installed.
-
Install the autodiscovery module.
-
Make the Monitoring Connectors available:
- If you have an online license, the Monitoring Connectors are already available in the interface.
- If you have an offline license in your central server's terminal, enter:
- Alma / RHEL / Oracle Linux 8
- Alma / RHEL / Oracle Linux 9
- Debian 11 & 12
dnf install centreon-pack-*
dnf install centreon-pack-*
apt install centreon-pack-*
-
To install the Amazon EC2 Monitoring Connector, go to Configuration > Monitoring Connector Manager.
-
In the Keyword field, type Amazon EC2 and then click Search.
-
Click the
+
sign in the top right corner of the Monitoring Connector. The Monitoring Connector now has a green border and a tick mark in the top right corner: configuration templates and discovery providers are now installed. -
Follow this procedure (sections Plugin dependencies and Setup) to finish installing the Monitoring Connector. (You can also access the documentation for a Monitoring Connector by clicking the
i
.)
Step 2: Configure the discovery job
-
Go to Configuration > Hosts > Discovery, and then click Add.
-
Enter a name for your discovery job, and then select the Amazon AWS EC2 provider. Click Next.
-
If your infrastructure requires it, fill in the details for the proxy you want to use.
-
Click the
+
sign to the right of the Choose credentials list. Fill in the Name, AWS Access Key and AWS Secret Key fields, then click Confirm. Click Next. -
Enter the region your EC2 instances are in (for example, eu-north-1). Click Next.
-
Edit or add mappers:
- Map
host.name
to thediscovery.results.name
attribute. The names of your hosts in Centreon will be the ones defined in this attribute (i.e. the hostname of the instance). - In our example, we will exclude instances whose hostname contains "test".
Click Next.
- Map
-
Select Manual analysis: we will have to add the hosts to the list of monitored hosts manually. Click Next.
-
Select Execute immediately and then click Finish. The discovery job appears in the list of jobs.
Step 3: Saving the hosts and monitoring them
-
After a few seconds, refresh the page. There should be a green tick mark in the Status column.
-
Hover over the job that has just ended and then click Display the job result (the arrow icon). A list of hosts appears.
Icons allow you to identify the action that will be performed on the host:
- The plus icon means the host does not exist yet and will be created.
- The arrow icon means the host already exists and its configuration will be updated.
-
Select the hosts you want to add to the list of monitored hosts, and then click Save.
-
Go to Configuration > Hosts > Hosts and check that the hosts you selected in the previous step appear in the list. The hosts are added to the lists of hosts but they are not monitored yet.
-
Deploy the configuration. The hosts appear in the Resources Status page: they are monitored.