telegraf: inputs.aliyuncms multiple dimensions doesnt work

Relevant telegraf.conf

[global_tags]

[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false

[[outputs.opentsdb]]
  host = "http://127.0.0.1"
  port = 19000
  http_batch_size = 50
  http_path = "/opentsdb/put"
  debug = false
  separator = "_"


[[inputs.aliyuncms]]
  regions = ["cn-hangzhou"]
  period = "5m"
  delay = "1m"
  interval = "5m"
  project = "acs_rds_dashboard"
  ratelimit = 200
  [[inputs.aliyuncms.metrics]]
    names = ["ConnectionUsage", "CpuUsage","DiskUsage","IOPSUsage","MemoryUsage"]
    dimensions = '[{"instanceId": "rm-bp1zureya4l415lus"},{"instanceId": "rm-bp161628eanrceqz2"}]'

Logs from Telegraf

[root@d5cs-jobs telegraf]# ./telegraf --config ./telegraf-aliyun.conf --test --debug 2022-03-18T04:29:18Z I! Starting Telegraf 1.21.4 2022-03-18T04:29:18Z I! Loaded inputs: aliyuncms 2022-03-18T04:29:18Z I! Loaded aggregators: 2022-03-18T04:29:18Z I! Loaded processors: 2022-03-18T04:29:18Z W! Outputs are not used in testing mode! 2022-03-18T04:29:18Z I! Tags enabled: host=d5cs-jobs 2022-03-18T04:29:18Z D! [agent] Initializing plugins 2022-03-18T04:29:18Z E! [telegraf] Error running agent: could not initialize input inputs.aliyuncms: Can’t parse dimensions (it is neither obj, nor array) “[{"instanceId": "rm-bp1zureya4l415lus"},{"instanceId": "rm-bp161628eanrceqz2"}]” :<nil>

System info

Telegraf 1.21.4

Docker

No response

Steps to reproduce

  1. running test command with ./telegraf --config ./telegraf-aliyun.conf --test --debug

Expected behavior

according to plugin example, we can pass an quoted arrary to dimension variable like dimensions = '[{"instanceId": "p-example"},{"instanceId": "q-example"}]'

Actual behavior

marshal failed

Additional info

dimensions = '{"instanceId": "p-example"}' signle dimensions is work properly

dimensions = [{"instanceId": "rm-bp1zureya4l415lus"},{"instanceId": "rm-bp161628eanrceqz2"}] also failed

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

i managed get an barely working code just for acs_rds_dashboard ,you can check out aliyuncms.go discovery.go