influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.63k stars 5.58k forks source link

Issue with filtering packages in custom build #13592

Closed qdrop17 closed 1 year ago

qdrop17 commented 1 year ago

Relevant telegraf.conf

## Telegraf Configuration for ThinClients
## /etc/telegraf/telegraf.conf

[global_tags]
  service_name = "thinclient"
  env = "prod"
  team = "planetexpress"

## Configuration for telegraf agent
[agent]
  ## Data input and output settings
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "5s"

  ## Logging configuration
  debug = false
  quiet = false
  # emtpy string means log to stderr
  logfile = ""

  ## host configuration
  # if emtpty use os.hostname()
  hostname = ""

  omit_hostname = false

# Configuration for sending metrics to Datadog
[[outputs.datadog]]
  ## Datadog API key
  apikey = "${datadog_secret}"

  ## Connection timeout.
  timeout = "5s"

  ## Write URL override; useful for debugging.
  url = "${datadog_url}"

## Metrics to log

[[inputs.system]]
  name_prefix = "dg.systemengineering.thinclient."
  # default configuration; getting uptime values.

[[inputs.mem]]
  name_prefix = "dg.systemengineering.thinclient."
  # no configuration

[[inputs.disk]]
  name_prefix = "dg.systemengineering.thinclient."
  ## By default stats will be gathered for all mount points.
  ## Set mount_points will restrict the stats to only the specified mount points.
  mount_points = ["/"]

[[inputs.swap]]
  name_prefix = "dg.systemengineering.thinclient."
  ## Monitoring SWAP (zswap) usage

  ## Ignore mount points by filesystem type.
  #ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]

Logs from Telegraf

Filtering packages failed: configured but unknown packages "agent.

System info

Ubuntu 23.04

Docker

# # Add telegraf telemetry service including systemd configuration.
COPY ./telegraf/telegraf.conf /etc/telegraf/telegraf.conf
# # Include the config in the build, such that only used input / output plugins are included in the binary
RUN git clone https://github.com/influxdata/telegraf.git && cd telegraf && make build_tools && ./tools/custom_builder/custom_builder --config /etc/telegraf/telegraf.conf

Steps to reproduce

git clone https://github.com/influxdata/telegraf.git
cd telegraf
make build_tools
./tools/custom_builder/custom_builder --config /etc/telegraf/telegraf.conf

Expected behavior

We expect that the custom builder only tries to install input / ouput plugins. But for some strange reason it tries to parse the agent- and the global_tags sections as plugins too. Which obviously fails.

Actual behavior

Filtering packages failed: configured but unknown packages "agent.metric_batch_size,agent.flush_interval,agent.metric_buffer_limit,agent.collection_jitter,agent.flush_jitter,agent.debug,agent.round_interval,agent.logfile,agent.hostname,agent.omit_hostname,agent.interval,global_tags.service_name,global_tags.env,global_tags.team,agent.quiet"

Additional info

We can work around this issue by removing the first 31 lines of the telegraf.conf file before building: RUN sed -i '1,31d' /etc/telegraf/telegraf.conf

Note that version 1.26 is working properly.

powersj commented 1 year ago

next steps: look into why the agent settings are causing errors, May also want to ensure the global tags section doesn't cause issues.

ianyxtan commented 1 year ago

I'm also trying to custom build telegraf for an embedded device. I was having this issue one day before:

Filtering packages failed: configured but unknown packages "agent.metric_batch_size,agent.flush_interval,agent.metric_buffer_limit,agent.collection_jitter,agent.flush_jitter,agent.debug,agent.round_interval,agent.logfile,agent.hostname,agent.omit_hostname,agent.interval,global_tags.service_name,global_tags.env,global_tags.team,agent.quiet"

After doing a git pull it's this error now:

Collecting plugins failed: open plugins/aggregators: no such file or directory

Why?

powersj commented 1 year ago

Collecting plugins failed: open plugins/aggregators: no such file or directory

Your first error is related, your second error is due to that folder not existing, which is unrelated.

neilbriscoe commented 1 year ago

+1 on this. I have a very simple telegraf.conf and its trying to parse [agent]. If I remove the entire [agent] section, the new custom build goes compile...

Also had to install go 1.2 as the "secrets" needed this - was using the ubuntu default of 1.8 beforehand.

srebhan commented 1 year ago

@qdrop17 and/or @neilbriscoe can you please test PR #13604 and let me know if this fixes your issue!?

gijsdb commented 1 year ago

@qdrop17 and/or @neilbriscoe can you please test PR #13604 and let me know if this fixes your issue!?

That seems to have resolved the issue for me :+1:

neilbriscoe commented 1 year ago

Seems to have resolved for me. A work around was to remove the [agent] section, compile, then re-add the [agent] section back in to the telegraf.conf file... worked as well. Thanks.