Collectd metrics

The OpenTelemetry Collector, when configured with a Prometheus receiver, provides an integration with Collectd to ingest metrics. The Collector scrapes metrics from the configured path in the Collectd configuration file using the Prometheus exporter. From there the metrics are processed and exported to Cloud Observability.

To complete the integration, you will:

  • Configure Collectd to use the Prometheus exporter.
  • Configure the Collector to use the Collectd endpoint as a scrape target for the Prometheus receiver.
  • Enable the integration by adding it to a pipeline

Prerequisites

  • Installed instance of Collectd
  • Your environment uses a supported Collectd plug-in (or a custom plug-in) that has been configured and is sucessfully communinicating with Collectd.
  • You’ve configured the OpenTelemetry Collector to export metric data to Cloud Observability.

Configure Collectd reporting

Collectd uses a plugin to run a local server that exports Prometheus metrics through a given port.

Edit the collectd.conf file to include the Prometheus plugin and ensure it already contains the configuration for the additional plug-in (replace <YOUR_COMPONENT_PLUGIN>) with the plug-in name):

1
2
3
4
5
6
7
8
LoadPlugin write_prometheus
<Plugin "write_prometheus">
  Port "9157"
</Plugin>

LoadPlugin YOUR_COMPONENT_PLUGIN
<Plugin YOUR_COMPONENT_PLUGIN>
</Plugin>

You need to configure both the Prometheus plug-in and the plug-in that emits metrics for the Collector to be able to receive those metrics.

Configure the Collector receiver

In the Collector configuration file, configure the Prometheus receiver to use the Collectd endpoint as a scrape target.

The targets field must be the same as the write_prometheus plugin’s port defined in collectd.conf.

1
2
3
4
5
6
7
8
9
receivers:
  prometheus/collectd:
    config:
      scrape_configs:
        - job_name: 'collectd-scraper'
          scrape_interval: 5s
          metrics_path: "/metrics"
          static_configs:
            - targets: [":9157"]

The OpenTelemetry repo’s readme provides additional details about Prometheus receiver configuration.

Enable the Collector receiver

Once the Collectd receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.

Validate metrics are reporting to Cloud Observability

You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Settings.

  1. In Cloud Observability, click Settings > Metric details.

  2. Search for Collectd metric names. Search for metric

  3. If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.

Create a dashboard for the metrics

Use the Cloud Observability Terraform Provider to create a dashboard for the metrics.

Additional resources

For a more complete example that’s ready to run, see the Collectd integration in Cloud Observability OpenTelemetry Examples.

See also

Create and manage dashboards

Create alerts

Updated Dec 1, 2022