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:
Collectd uses a plugin to run a local server that exports Prometheus metrics through a given port.
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.
In the Collector configuration file, configure the Prometheus receiver to use the Collectd endpoint as a scrape target.
targets field must be the same as the
write_prometheus plugin’s port defined in
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.
Once the Collectd receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.
You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Project settings.
In Cloud Observability, click Project settings > Metric details.
Search for Collectd metric names.
If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.
Use the Cloud Observability Terraform Provider to create a dashboard for the metrics.
For a more complete example that’s ready to run, see the Collectd integration in Cloud Observability OpenTelemetry Examples.
Updated Dec 1, 2022