|
| 1 | +.. _telegraf: |
| 2 | + |
| 3 | +Monitor services with Telegraf and OpenTelemetry |
| 4 | +======================================================== |
| 5 | + |
| 6 | +.. meta:: |
| 7 | + :description: Use this Splunk Observability Cloud integration for the Telegraf monitor. See benefits, install, configuration, and metrics. |
| 8 | + |
| 9 | +To monitor your service with Telegraf using native OpenTelemetry in Splunk Observability Cloud, install the service's Telegraf plugin then push metrics to the Splunk Opentelemetry Collector |
| 10 | +via OTLP. |
| 11 | + |
| 12 | +.. note:: This setup is designed for a Linux Ubuntu OS but should be replicable on any machines running Linux OS with Debian flavor. These instructions might not work on other OS (MacOS/Windows). |
| 13 | + |
| 14 | +Benefits |
| 15 | +-------- |
| 16 | + |
| 17 | +.. include:: /_includes/benefits.rst |
| 18 | + |
| 19 | +Configuration |
| 20 | +---------------------------------- |
| 21 | + |
| 22 | +Follow these steps to scrape Telegraf metrics with the OTel Collector: |
| 23 | + |
| 24 | +1. Install Telegraf |
| 25 | +2. Set up your service's Telegraf Input plugin |
| 26 | +3. Set up the Telegraf OpenTelemetry Output plugin |
| 27 | +4. Configure the OpenTelemetry Collector |
| 28 | + |
| 29 | +1. Install Telegraf |
| 30 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 31 | + |
| 32 | +Run the following commands to install Telegraf from the InfluxData repository: |
| 33 | + |
| 34 | +.. code:: shell |
| 35 | +
|
| 36 | + curl --silent --location -O \ https://repos.influxdata.com/influxdata-archive.key \ && echo "943666881a1b8d9b849b74caebf02d3465d6beb716510d86a39f6c8e8dac7515 influxdata-archive.key" \ |
| 37 | + | sha256sum -c - && cat influxdata-archive.key \ |
| 38 | + | gpg --dearmor \ |
| 39 | + | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive.gpg > /dev/null \ |
| 40 | + && echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive.gpg] https://repos.influxdata.com/debian stable main' \ |
| 41 | + | sudo tee /etc/apt/sources.list.d/influxdata.list |
| 42 | + sudo apt-get update && sudo apt-get install telegraf |
| 43 | +
|
| 44 | +2. Set up your service's Telegraf Input plugin |
| 45 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 46 | + |
| 47 | +Next, install the Telegraf Input plugin for the service you want to monitor. Available plugins include Chrony, Consul, Docker, Elasticsearch, Fluentd, GitHub, Jenkins, RabbitMQ or SQL. Find a complete list of Input plugins at :new-page:`Telegraf Input plugins <https://github.com/influxdata/telegraf/tree/master/plugins/inputs/exec>` in GitHub. |
| 48 | + |
| 49 | +For example, if you want to monitor execute commands on every interval and parse metrics from their output with the exec input plugin, use a setup like: |
| 50 | + |
| 51 | +.. code:: |
| 52 | +
|
| 53 | + # Read metrics from one or more commands that can output to stdout |
| 54 | + [[inputs.exec]] |
| 55 | + |
| 56 | + ## Commands array |
| 57 | + commands = ["sh /testfolder/testscript.sh"] |
| 58 | + timeout = "30s" |
| 59 | + data_format = "influx" |
| 60 | +
|
| 61 | + ## Environment variables |
| 62 | + ## Array of "key=value" pairs to pass as environment variables |
| 63 | + ## e.g. "KEY=value", "USERNAME=John Doe", |
| 64 | + ## "LD_LIBRARY_PATH=/opt/custom/lib64:/usr/local/libs" |
| 65 | + # environment = [] |
| 66 | +
|
| 67 | + ## Measurement name suffix |
| 68 | + ## Used for separating different commands |
| 69 | + # name_suffix = "" |
| 70 | +
|
| 71 | + ## Ignore Error Code |
| 72 | + ## If set to true, a non-zero error code in not considered an error and the |
| 73 | + ## plugin will continue to parse the output. |
| 74 | + # ignore_error = false |
| 75 | +
|
| 76 | +3. Set up the Telegraf OpenTelemetry Output plugin |
| 77 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 78 | + |
| 79 | +Next, add the OTel Output plugin to your Telegraf configuration file: |
| 80 | + |
| 81 | +.. code:: |
| 82 | + |
| 83 | + # Send OpenTelemetry metrics over gRPC |
| 84 | + [[outputs.opentelemetry]] |
| 85 | +
|
| 86 | +The config file usually resides on the ./etc/telegraf/telegraf.d directory. |
| 87 | + |
| 88 | +For detailed information see Telegraf's :new-page:`OpenTelemetry Output plugin <https://github.com/influxdata/telegraf/blob/master/plugins/outputs/opentelemetry/README.md>` documentation in GitHub. |
| 89 | + |
| 90 | +4. Configure the OpenTelemetry Collector |
| 91 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 92 | + |
| 93 | +Add the following configuration to the OTel Collector to retrieve metrics from the Telegraf installation: |
| 94 | + |
| 95 | +.. code:: yaml |
| 96 | +
|
| 97 | + receivers: |
| 98 | + otlp: |
| 99 | + protocols: |
| 100 | + http: |
| 101 | + grpc: |
| 102 | + signalfx: |
| 103 | + |
| 104 | + exporters: |
| 105 | + signalfx: |
| 106 | + access_token: "SPLUNK_TOKEN" |
| 107 | + realm: "us0" |
| 108 | + |
| 109 | + service: |
| 110 | + pipelines: |
| 111 | + metrics: |
| 112 | + receivers: [otlp] |
| 113 | + exporters: [signalfx] |
| 114 | + metrics/internal: |
| 115 | + receivers: [signalfx] |
| 116 | + processors: |
| 117 | + exporters: [signalfx] |
| 118 | +
|
| 119 | +Troubleshooting |
| 120 | +--------------- |
| 121 | + |
| 122 | +.. include:: /_includes/troubleshooting-components.rst |
0 commit comments