influxdata / telegraf

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

Azure Monitor input plugin does not watch for new resources #15573

Open csdaraujo opened 5 days ago

csdaraujo commented 5 days ago

Relevant telegraf.conf

[[inputs.azure_monitor.subscription_target]]
  resource_type = "Microsoft.Compute/disks"
  metrics = [
    "Composite Disk Read Bytes/sec",
    "Composite Disk Read Operations/sec",
    "Composite Disk Write Bytes/sec",
    "Composite Disk Write Operations/sec",
  ]
  aggregations = [ "Average" ]

Logs from Telegraf

No valuable logs since the issue relates to new resources that are not identified/included by Telegraf after creation.

System info

Commit d7f3a0e, Ubuntu 22.04, Kubernetes 1.29

Docker

No response

Steps to reproduce

  1. Install and run telegraf monitoring Azure resources
  2. Create a new resource for a type that is monitored by Telegraf (example used disk, so a PVC in k8s)
  3. Check if metrics for the new resources are sent

Expected behavior

New resources should be monitored by Telegraf without the need for a restart (which adds the new resource).

Actual behavior

New resource is not monitored until restart.

Additional info

There should be some kind of watch mechanism to include new resources.

powersj commented 5 days ago

Hi,

It looks like the only time we collect the resources is during Init during start up. The result of that is the resources to montior and a debug message about the total number of targets.

Are you suggesting some sort of timer to refresh that list? Is this something you want to put up a PR for?

I'd suggest making this opt-in with a config option like:

## Resource refresh interval
## Interval to refresh the targets used for montioring. Disabled by default
## and when passed a zero value.
# refresh_interval = "0s"
csdaraujo commented 5 days ago

Yes. That would work! Will work on a PR for us.

Thank you!