influxdata/telegraf

[inputs.openweathermap] Version 2.5 of the API is no longer supported

开放

#17,546 创建于 2025年8月29日

 (13 条评论) (5 个反应) (0 位负责人)Go (5,837 个派生)batch import
bughelp wantedsize/m

仓库指标

星标
 (17,764 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Relevant telegraf.conf

[[inputs.openweathermap]]
  ## OpenWeatherMap API key.
  app_id = "xxxxxxxxxxxxxxxxxxxxxxxxxx"

  ## City ID's to collect weather data from.
  city_id = ["0000000"]

  ## Language of the description field. Can be one of "ar", "bg",
  ## "ca", "cz", "de", "el", "en", "fa", "fi", "fr", "gl", "hr", "hu",
  ## "it", "ja", "kr", "la", "lt", "mk", "nl", "pl", "pt", "ro", "ru",
  ## "se", "sk", "sl", "es", "tr", "ua", "vi", "zh_cn", "zh_tw"
  lang = "en"

  ## APIs to fetch; can contain "weather" or "forecast".
  fetch = ["weather", "forecast"]

  ## OpenWeatherMap base URL
  # base_url = "https://api.openweathermap.org/"

  ## Timeout for HTTP response.
  # response_timeout = "5s"

  ## Preferred unit system for temperature and wind speed. Can be one of
  ## "metric", "imperial", or "standard".
  units = "imperial"

  ## Query interval; OpenWeatherMap weather data is updated every 10
  ## minutes.
  interval = "10m"

Logs from Telegraf

2025-08-29T05:40:00Z E! [inputs.openweathermap] Error in plugin: querying "https://api.openweathermap.org/data/2.5/group?APPID=xxxxxxxxxxxxxxxxx&id=0000000&lang=en&units=imperial" failed: https://api.openweathermap.org/data/2.5/group?APPID=xxxxxxxxxxxxxxxxx&id=0000000&lang=en&units=imperial returned HTTP status 401 Unauthorized

System info

telegraf:1.35.4-alpine, Debian 13, k8s v1.33.3

Docker

No response

Steps to reproduce

  1. Attempt to create and run the openweathermap input with any valid configuration

Expected behavior

Input is able to hit and retrieve data from OpenWeathermap

Actual behavior

Telegraf returns a 401 error as version 2.5 of the API is no longer being hosted

Additional info

It seems that access to the 2.5 version of the API has been closed since June 2024, but the endpoint was still functional until today: https://openweathermap.org/one-call-transfer

Seems that the input will need to be fixed to utilize the 3.0 version of the API, as described in the linked blog post.

贡献者指南