Skip to main content

Centreon Monitoring Agent

Introduction​

The Centreon Monitoring Agent (CMA) is a piece of software installed on the host it monitors: it collects metrics and computes statuses, and sends them to Centreon.

The agent can execute native checks, or use Centreon plugins to execute non-native checks. Native checks are run directly by the agent (as opposed to non-native checks, which require local plugins to be installed on the host). Native checks have better performance and a better footprint (reduced CPU and memory usage).

Both native and non-native checks are defined in either the Linux Centreon Monitoring Agent connector or the Windows Centreon Monitoring Agent connector. The connectors provide the templates and the agent retrieves the configuration of these checks at regular intervals after the connection has been established.

The agent performs the checks (for non-native checks, using the local plugins) and sends the data to the poller. The part of the poller's Engine that receives data from the agent is called the OTLP receiver (OTLP means OpenTelemetry protocol).

Custom Nagios-compatible plugins can also be used with this agent.

When do I need to use an agent?​

Use the CMA agent:

  • when security policies only allow outgoing flows (no checks can be performed by pollers, SNMP is not authorized).
  • on sites that have no local poller.
  • when you need to run a script locally on the monitored machine for security (rights and/or protocols) or performance reasons.

How do the host and the poller interact?​

Depending on the case, either the agent or the poller initiates the connection.

  • In the case of an agent-initiated connection, you simply configure the poller to listen on a specific port. A poller can receive data from n agents/hosts.
  • If the agent is not allowed to connect to the poller for security reasons (e.g. when the poller is in a DMZ), you can use a poller-initiated connection. You need to declare in Centreon each host that will be monitored by this agent in the Poller/agent configuration menu. The poller will receive data from n hosts via the agent.

Depending on the direction in which the connection is established, the poller or host can be either client or server. The connection between the poller and the agent must be secure in production.

Store the certificates in the /etc/pki directory of the poller. Store them where you like on the host. The diagrams below describe the certificate files to be used in each case.

image

The poller will be configured the following way, using the Poller/agent configuration page, in the OTLP receiver section:

  • Public certificate (mandatory). If you have stored the poller's certificate in the Certificate Store, you don't need to enter a file for the public key. Otherwise, you need to provide the path to the file containing the public key of the poller's opentelemetry server. The DNS name that the agent will use to connect to the poller must be identical to the CN of the certificate. If this is not possible, you can add an IP collector_host_name mapping in the C:\Windows\System32\drivers\etc\hosts file (Windows) or /etc/hosts (Linux).
  • Private key (mandatory)
  • CA: rarely necessary in this case, except to manage a double handshake. The TLS protocol with certificates validates the identity of the server for the client, but the "double handshake" goes further: it adds the validation of the client's identity by the server. This is useful for enhanced security but rarely necessary on the internet.

The agent will be configured the following way on the host (for Windows using the installer or the CLI, and for Linux using the centagent.json file).

  • Encryption = yes
  • Trusted CA’s certificate file (can be loaded into the certificate store and not referenced in the agent's configuration)
  • Certificate Common Name (rarely necessary)

Supported OSs​

The CMA can be installed on and monitor the following OSs:

  • Alma 8
  • Alma 9
  • Debian 11
  • Debian 12
  • Ubuntu 22.04 LTS

Limitations​

The Centreon Monitoring Agent is in Beta Phase. The following limitations need to be considered :

  • The scope of supported monitoring is limited, new (native) controls will be introduced in the final version.

Step 1: Configure Centreon​

Install the Monitoring Connector you need​

On your central server, you need to install the monitoring connector that will provide the templates and commands that will allow you to configure the monitored hosts and services in Centreon.

  1. On your central server, go to Configuration > Connectors > Monitoring Connectors.
  2. Install the Linux Centreon Monitoring Agent monitoring connector.

Create the CMA connector​

For this version, no configuration is needed. Move on to the next step.

Configure poller/agent communication​

Configure how the poller and the agent will communicate:

  1. On your central server, go to Configuration > Pollers > Agent configurations and click Add poller/agent configuration.
  2. In the window that opens, select CMA. Additional fields appear.
  3. In the Parameters section, select the poller(s) that will receive data from the agent.
  4. In the OTLP receiver section, enter the file names for the certificates for the part of the poller that will receive data from the agent, i.e., the poller's engine. Communication between the agent and the poller is always in HTTPS. You need to store the certificates in the /etc/pki/ directory of the poller.
  1. If the agent is not allowed to connect to the poller for security reasons (e.g. when the poller is in a DMZ), enable Connection initiated by poller. Then, in Host configurations, define all the hosts on which the agent will be installed.

If you configure several pollers at once, make sure all certificate files have the same name.

  1. Deploy the configuration.

  2. Restart the monitoring engine:

    systemctl restart centengine

The CMA can now communicate with Centreon. You can set up the monitoring of your hosts.

Step 2: Prepare the host​

Download and install the agent​

Install the Centreon repository and the agent​

Install the Centreon repository and agent using the following commands:

dnf install -y dnf-plugins-core
dnf config-manager --add-repo https://packages.centreon.com/rpm-standard/24.10/el8/centreon-24.10.repo
dnf install centreon-monitoring-agent

Configure centreon-monitoring-agent​

Replace the contents of the /etc/centreon-monitoring-agent/centagent.json file with the following parameters (4 cases):

{
"log_level":"info",
"endpoint":"<IP POLLER>:4317",
"host":"host_1",
"log_type":"file",
"log_file":"/var/log/centreon-monitoring-agent/centagent.log"
}

In the host field, enter the name of the host to be monitored as you have entered it in the Centreon interface. If absent, the agent will use the machine's hostname.

Configure the logs​

You can configure two kinds of log output:

  • file: the CMA logs into a file, the path is configured in the log_file option.
  • stdout: standard output is used.

If you choose to log into a file, log rotation can be customized using the log_max_file_size and log_max_files options.

Allowed log levels are:

  • off: no logs
  • critical: critical errors
  • error: all errors
  • info: additional information
  • debug: more information about connections
  • trace: the most verbose trace level showing messages sent and received to the poller

Restart the agent​

Restart the CMA:

systemctl restart centagent

You can check that the agent is running using the following command:

systemctl status centagent

Deploy the Centreon agent plugins​

If you want to run non-native checks, you need to install the Centreon plugins, that will execute the checks on the host.

Enable our plugins repository and install the plugins​

This repository will provide you our packaged plugins as well as the dependencies that are not available in the standard distribution repositories.

dnf -y install dnf-plugins-core oracle-epel-release-el8
dnf config-manager --set-enabled ol8_codeready_builder

cat >/etc/yum.repos.d/centreon-plugins.repo <<'EOF'
[centreon-plugins-stable]
name=Centreon plugins repository.
baseurl=https://packages.centreon.com/rpm-plugins/el8/stable/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES
module_hotfixes=1

[centreon-plugins-stable-noarch]
name=Centreon plugins repository.
baseurl=https://packages.centreon.com/rpm-plugins/el8/stable/noarch/
enabled=1
gpgcheck=1
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES
module_hotfixes=1

[centreon-plugins-testing]
name=Centreon plugins repository. (UNSUPPORTED)
baseurl=https://packages.centreon.com/rpm-plugins/el8/testing/$basearch/
enabled=0
gpgcheck=1
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES
module_hotfixes=1

[centreon-plugins-testing-noarch]
name=Centreon plugins repository. (UNSUPPORTED)
baseurl=https://packages.centreon.com/rpm-plugins/el8/testing/noarch/
enabled=0
gpgcheck=1
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES
module_hotfixes=1

[centreon-plugins-unstable]
name=Centreon plugins repository. (UNSUPPORTED)
baseurl=https://packages.centreon.com/rpm-plugins/el8/unstable/$basearch/
enabled=0
gpgcheck=1
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES
module_hotfixes=1

[centreon-plugins-unstable-noarch]
name=Centreon plugins repository. (UNSUPPORTED)
baseurl=https://packages.centreon.com/rpm-plugins/el8/unstable/noarch/
enabled=0
gpgcheck=1
gpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES
module_hotfixes=1
EOF

Install the plugin:

dnf install -y centreon-plugin-Operatingsystems-Linux-Local.noarch

Step 3: Monitoring a host with the CMA​

Create hosts using templates​

On the central server, create hosts and apply to them the OS-Linux-Centreon-Monitoring-Agent-custom template. The template includes the Enable passive checks option set to on.