influxdata / telegraf

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

Error parsing url for http input #8620

Closed wellsgz closed 3 years ago

wellsgz commented 3 years ago

Relevant telegraf.conf:

[[inputs.http]]
  ## One or more URLs from which to read formatted metrics
  interval = "30s"
  urls = ["http://A.B.C.D:8123/api/states/sensor.0x158d0004448ae5_humidity"]
  headers = {"Authorization" = "Bearer XXXX"}
  #HTTP method
  method = "GET"
  timeout = "15s"
  data_format = "json"
  name_override = "hass.airquality"
  tag_keys = [
    "attributes",
  ]
  [inputs.http.tags]
    host="livingroom.airquality"

System info:

Telegraf 1.17.0 (git: HEAD 3f7a54c9)

Steps to reproduce:

  1. Test configure with debug flag
  2. The url seems to be ignored

Expected behavior:

❯ telegraf -config ./test.conf -test --debug 2020-12-26T12:43:55Z I! Starting Telegraf 1.17.0 2020-12-26T12:43:55Z D! [agent] Initializing plugins 2020-12-26T12:43:55Z D! [agent] Starting service inputs

hass.airquality,host=livingroom.airquality,url=http://A.B.C.D:8123/api/states/air_quality.xiaomi_miio_air_quality_monitor attributes_carbon_dioxide_equivalent=944,attributes_humidity=48.8,attributes_particulate_matter_2_5=0.1,attributes_temperature=28.2,attributes_total_volatile_organic_compounds=1.857 1608986636000000000 2020-12-26T12:43:55Z D! [agent] Stopping service inputs 2020-12-26T12:43:55Z D! [agent] Input channel closed 2020-12-26T12:43:55Z D! [agent] Stopped Successfully

Actual behavior:

http call return with result, e.g.

2020-12-26T12:59:26Z I! Starting Telegraf 1.17.0 2020-12-26T12:59:26Z D! [agent] Initializing plugins 2020-12-26T12:59:26Z D! [agent] Starting service inputs 2020-12-26T12:59:26Z D! [agent] Stopping service inputs 2020-12-26T12:59:26Z D! [agent] Input channel closed 2020-12-26T12:59:26Z D! [agent] Stopped Successfully

Additional info:

wellsgz commented 3 years ago

Did more test and figure out it's returning data issue, closing the issue.