Agent interval multiple configs

Hi,

I have a qeustions about the agent interval. We have two configs in the telegraf.d folder.
One for collecting system metrics, other to run some tests. Both have a diffrent interval in the agent. The system metric should run every 10 seconds. Where the test should run every 5 minutes. Now the both are running every 5 minutes.

It seems that only one agent setting is applied. This is by design or do I something wrong?

System metrics snap :

[agent]
  interval = "10s"

[[inputs.cpu]]
  name_override = "cpu"
  percpu = true
  totalcpu = true
  fielddrop = ["time_*"]

test metrics snap:

# Change the Global tags accordingly
[global_tags]
  CPE = "DX5401-B0"
  Network = "ODF-Fiber"
  Type = "B2B"

[agent]
  interval = "5m"
  round_interval = true

# Sent 20 ICMP ping every 5 minutes to the targets to measure the latancy and packet loss
[[inputs.ping]]
  name_override = "ping"
  count = 20

When telegraf starts, the 5m interval is applied;


Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! Available plugins: 233 inputs, 9 aggregators, 31 processors, 24 parsers, 60 outputs>
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! Loaded inputs: cpu (2x) disk (2x) diskio (2x) dns_query (4x) exec http_response (4x>
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! Loaded aggregators:
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! Loaded processors:
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! Loaded secretstores:
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! Loaded outputs: influxdb (2x)
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! Tags enabled: CPE=DX5401-B0 Network=ODF-Fiber Type=B2B host=probe02
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z I! [agent] Config: Interval:5m0s, Quiet:false, Hostname:"probe02", Flush Interval:10s
Mar 25 08:54:21 probe02 telegraf[21727]: 2024-03-25T07:54:21Z W! DeprecationWarning: Value "false" for option "ignore_protocol_stats" of plugin "inp>
Mar 25 08:54:21 probe02 systemd[1]: Started telegraf.service - Telegraf.

You should only have 1 global_tags and agent setting in your config files, since all files get merged together on startup.

It is possible to override the global agent interval and tags on a per input basis.

1 Like

I thought so :wink: . I will change the configs with the interval per input

2 Likes

@Hipska thank you for your answers here :slight_smile:

1 Like