
!Docker Pulls !Docker Automated https://goreportcard.com/badge/github.com/billykwooten/openweather-exporter](https://goreportcard.com/report/github.com/billykwooten/openweather-exporter) !Go Version
用于OpenWeather API的Prometheus导出器。
注意:从本导出器的0.0.12版本开始,您需要注册API 3.0免费或付费订阅,您的API密钥才能生效。
git bashOpenWeather导出器可通过环境变量(ENV)或命令行标志(CLI flags)进行控制,如下所述。
启用OW_ENABLE_POL将增加API调用次数以拉取污染/空气质量数据,请注意您的API调用量,以免产生费用。详见OpenWeather定价此处。
| 环境变量 | CLI标志(--flag) | 默认值 | 描述 |
|---|---|---|---|
OW_LISTEN_ADDRESS | listen-address | :9091 | /metrics端点监听的端口 |
OW_APIKEY | apikey | <必填> | 您的OpenWeather API密钥 |
OW_CITY | city | New York, NY | 收集天气指标的城市/位置。多个位置用|分隔,例如"New York, NY|Seattle, WA" |
OW_DEGREES_UNIT | degrees-unit | F | 温度单位(开尔文、华氏度或摄氏度) |
OW_LANGUAGE | language | EN | 指标显示的语言 |
OW_CACHE_TTL | cache-ttl | 300 | 缓存生存时间(秒) |
OW_ENABLE_POL | enable-pol | false(布尔值) | 启用污染指标 |
bash# 使用二进制从西雅图收集天气指标,并启用污染/紫外线指标 ./openweather-exporter --city "Seattle, WA" --apikey mi4o2n54i0510n4510 --enable-pol
bash# 使用Docker从西雅图收集天气指标 docker run -d --restart on-failure --name=openweather-exporter -p 9091:9091 billykwooten/openweather-exporter --city "Seattle, WA" --apikey mi4o2n54i0510n4510
yamlopenweather-exporter: image: billykwooten/openweather-exporter container_name: openweather-exporter restart: always ports: - "9091:9091" environment: - OW_CITY=New York, NY - OW_APIKEY=mi4o2n54i0510n4510 - OW_ENABLE_POL=true
yamlscrape_configs: - job_name: 'openweather-exporter' scrape_interval: 60s static_configs: - targets: ['openweather-exporter:9091']
以下是导出器默认收集的OpenWeather指标。
| 指标名称 | 描述 |
|---|---|
openweather_temperature | 当前温度(度) |
openweather_humidity | 当前相对湿度 |
openweather_feelslike | 当前体感温度(度, heat index) |
openweather_pressure | 当前大气压力(百帕) |
openweather_windspeed | 当前风速(英里/小时,若为英制则为米/秒) |
openweather_rain1h | 过去1小时降雨量(毫米) |
openweather_snow1h | 过去1小时降雪量(毫米) |
openweather_winddegree | 风向(度,气象学角度) |
openweather_cloudiness | 云量(百分比) |
openweather_sunrise | 日出时间(Unix时间戳,UTC) |
openweather_sunset | 日落时间(Unix时间戳,UTC) |
openweather_currentconditions | 当前天气状况(晴天、多云、雨天等) |
openweather_ultraviolet_index | 紫外线指数 |
若启用污染指标,将增加以下指标:
| 指标名称 | 描述 |
|---|---|
openweather_pollution_airqualityindex | 空气质量指数。1=优,2=良,3=轻度污染,4=中度污染,5=重度污染。 |
openweather_pollution_carbonmonoxide | 一氧化碳(CO)浓度(μg/m³) |
openweather_pollution_nitrogenmonoxide | 一氧化氮(NO)浓度(μg/m³) |
openweather_pollution_nitrogendioxide | 二氧化氮(NO₂)浓度(μg/m³) |
openweather_pollution_ozone | 臭氧(O₃)浓度(μg/m³) |
openweather_pollution_sulphurdioxide | 二氧化硫(SO₂)浓度(μg/m³) |
openweather_pollution_pm25 | PM2.5(细颗粒物)浓度(μg/m³) |
openweather_pollution_pm10 | PM10(粗颗粒物)浓度(μg/m³) |
openweather_pollution_nh3 | 氨(NH₃)浓度(μg/m³) |
我为此导出器创建了一个Grafana仪表板,欢迎使用。链接如下:
https://github.com/billykwooten/GrafanaDashboards/blob/master/open_weather_map.json
若您想自行构建,可克隆本仓库并运行:
bash./script/cibuild
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务