influxdata / community-templates

InfluxDB Community Templates: Quickly collect & analyze time series data from a range of sources: Kubernetes, MySQL, Postgres, AWS, Nginx, Jenkins, and more.

Home Page:https://www.influxdata.com/products/influxdb-templates/gallery/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AQI telegraf config is outdated.

sarvesh-lad opened this issue · comments

Template: airquality

Describe the problem
Incorrect telegraf config

To Reproduce
Steps to reproduce the behavior:
Setup AirQuality telegraf agent an you will see error:

2023-02-22T23:20:30Z E! [inputs.http] Error in plugin: [url=AQI_URL]: instantiating parser failed: line 28: (json.Parser.TimeKey) cannot unmarshal TOML array into string (need slice)

The config section giving trouble:

  ## Data format to consume.
  data_format = "json"
  json_time_key = ["DateForecast"]
  json_time_format = "2006 01 02 "
  tag_keys = ["Category_Name", "ParameterName", "Latitude", "Longitude", "ReportingArea"]
  json_string_fields = ["ActionDay"]

Expected behavior
It shouldn't be parsed as an array. It can be easily fixed by changing the time key and format.

  ## Data format to consume.
  data_format = "json"
  json_time_key = "DateForecast"
  json_time_format = "2006-01-02 "
  tag_keys = ["Category_Name", "ParameterName", "Latitude", "Longitude", "ReportingArea"]
  json_string_fields = ["ActionDay"]

Screenshots
If applicable, add screenshots to help explain your problem.

How are you running InfluxDB?

  • InfluxDB 2.0 on a remote server

Additional context
The current output of the AQI request:

[
  {
    "DateIssue": "2023-02-22 ",
    "DateForecast": "2023-02-22 ",
    "ReportingArea": "Dallas-Fort Worth",
    "StateCode": "TX",
    "Latitude": 32.767,
    "Longitude": -96.783,
    "ParameterName": "O3",
    "AQI": -1,
    "Category": {
      "Number": 1,
      "Name": "Good"
    },
    "ActionDay": false,
    "Discussion": "https://www.tceq.texas.gov/airquality/monops/forecast_today.html"
  },
...
]