Skip to main content

Telegraf

Introduction​

The Telegraf agent collects metrics and computes statuses on the servers it monitors, and sends them to Centreon. Centreon's OpenTelemetry processor allows it to understand data sent in OpenTelemetry format.

Developed by InfluxDB, the Telegraf agent can be installed on Windows or Linux servers. Centreon Engine is able to send the configuration of monitored resources to the agent (existing hosts, thresholds...), so that the agent can execute checks and compute the statuses of these resources.

As they are Nagios-based, both Centreon and custom plugins are compatible with the agent. This is because Centreon's Telegraf integration is based on the native Nagios input data format.

Limitations​

Due to Telegraf or Centreon constraints, the following limitations need to be considered.

  • Due to Telegraf limitations, the configuration of resources known to the agent is only updated when you start or reload the agent (typically, you would do that after deploying the configuration). Technically, the agent requests an up-to-date configuration from Centreon.
  • Only known metrics (i.e., the metrics for the hosts and services created in Centreon) are sent to Centreon. Metrics for unknown hosts or services are discarded.
  • Only metrics and statuses are returned (no outputs).
  • Network connections are one-way only: data goes from the agent to the poller. This means that a host in a DMZ will need a poller in this DMZ.
  • When an enhancement or fix is released, the Centreon plugin must be re-deployed on your monitored host (there is no auto-update).

Step 1: Configure Centreon​

Install the Monitoring Connector​

  1. On your central server, go to Configuration > Monitoring Connector Manager.
  2. Install the Linux Telegraf Agent monitoring connector.

Create the Telegraf connector​

Install the Open Telemetry processor for Telegraf on your central server:

  1. Go to Configuration > Commands > Connectors.
  2. Create a new connector with the following values:
ParameterValue
Connector NameTelegraf
Connector DescriptionTelegraf
Command Lineopentelemetry --processor=nagios_telegraf --extractor=attributes --host_path=resource_metrics.scope_metrics.data.data_points.attributes.host --service_path=resource_metrics.scope_metrics.data.data_points.attributes.service
Used by commandType Telegraf-Agent and click Select all
Connector StatusEnabled

Configure Engine​

Configure how the poller and the agent will communicate:

  • Some agents can connect to the poller, while the poller can connect to some other agents.
  • You can select several pollers at once in a single configuration form so that you don't have to do the same configuration several times.
  1. Go to Configuration > Pollers > Agent configurations and click Add poller/agent configuration.
  2. In the window that opens, select the type of agent you want to configure. 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. The Configuration provider is the server inside the poller's engine that will send the agent its configuration. Enter the port and the file names for the certificates. The certificates must be stored in the /etc/pki/ directory. You can use the same certificates as for the OTLP receiver.

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

  1. Export the configuration

  2. Restart the monitoring engine

    systemctl restart centengine

The Telegraf agent is now able to communicate with Centreon. You can set up the monitoring of your hosts.

Step 2: Prepare the host​

Download and install the agent​

dnf -y install epel-release
dnf -y config-manager --set-enabled 'powertools'

This part is an excerpt from Telegraf's official documentation.

cat > /etc/yum.repos.d/influxdb.repo <<'EOF'
[influxdb]
name = InfluxData Repository - Stable
baseurl = https://repos.influxdata.com/stable/$basearch/main
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key
EOF
dnf install -y telegraf

Then:

  1. Stop the Telegraf service
systemctl stop telegraf
  1. Edit the telegraf.service file.
vi /etc/systemd/system/telegraf.service
  1. Replace:
/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OPTS

By (replace the placeholders by your values):

/usr/bin/telegraf -config http(s)://<ip poller>:<port poller>/engine?host=<host to monitor>
  1. Start the Telegraf service:
systemctl start telegraf

Deploy the Centreon plugin​

The Centreon plugin will execute the checks on the host.

Enable our plugins repository and install the plugin​

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

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 Telegraf agent​

Create hosts using templates​

On the central server, create hosts and apply to them the OS-Linux-Telegraf-Agent-custom template.

Reload the agent​

To let the agent know about the hosts you just created and start monitoring them, run the following command on the host:

systemctl restart telegraf