{"id":26128956,"url":"https://github.com/evaneaston/openweathermap","last_synced_at":"2025-09-07T10:39:08.036Z","repository":{"id":60998504,"uuid":"547429061","full_name":"evaneaston/openweathermap","owner":"evaneaston","description":"A client library for the free, v2.5 OpenWeatherMap.org API and a prometheus exporter, written in rust.","archived":false,"fork":false,"pushed_at":"2025-09-04T04:42:12.000Z","size":453,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-04T06:26:52.894Z","etag":null,"topics":["openweathermap","openweathermap-api","prometheus-exporter","prometheus-metrics","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evaneaston.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-07T17:09:18.000Z","updated_at":"2025-09-04T04:37:22.000Z","dependencies_parsed_at":"2024-03-27T02:41:18.428Z","dependency_job_id":"0acad081-9002-425c-b154-85c2890b5430","html_url":"https://github.com/evaneaston/openweathermap","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"05e708d1c944809319aa298abff788c7ac9c59ea"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/evaneaston/openweathermap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaneaston%2Fopenweathermap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaneaston%2Fopenweathermap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaneaston%2Fopenweathermap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaneaston%2Fopenweathermap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evaneaston","download_url":"https://codeload.github.com/evaneaston/openweathermap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evaneaston%2Fopenweathermap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273641900,"owners_count":25142252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openweathermap","openweathermap-api","prometheus-exporter","prometheus-metrics","rust"],"created_at":"2025-03-10T19:29:36.146Z","updated_at":"2025-09-07T10:39:07.999Z","avatar_url":"https://github.com/evaneaston.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenWeatherMap\n## Client Library + Prometheus Exporter\n\nThis is a mono-repo for two rust crates:\n\n| Crate                                             | Description                                                                                                                            |\n| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |\n| [openweathermap_client](#openweathermap_client)   | A rust library for querying weather readings from OpenWeatherMap's free v2.5 API                                                       |\n| [openweathermap_exporter](#openweathermap_client) | A prometheus exporter to query weather readings for many locations and publis their values in as metrics prometheus exposition format. |\n\n[![CI](https://github.com/evaneaston/openweathermap/actions/workflows/ci.yml/badge.svg)](https://github.com/evaneaston/openweathermap/actions/workflows/ci.yml)\n\n---\n\n## openweathermap_client\n\n[docs.rs](https://docs.rs/openweathermap_client) | [crates.io](https://crates.io/crates/openweathermap_client)\n\n`openweathermap_client` is a rust library that provides a client for querying OpenWeatherMap's free [version 2.5 weather API](https://openweathermap.org/current).\n\n### Features:\n\n- Binds query results into structs derived from [OpenWeatherMap's weather-data docs](https://openweathermap.org/weather-data) using [serde](https://crates.io/crates/serde).\n- Supports requesting results in OWM's `Standard`, `Metric`, or `Imperial` unit systems.\n- Supports requesting that the API translate of city names and weather descriptions into [supported languages](https://openweathermap.org/current#multi).\n- Cross platform. Tested to confirm it runs on Windows, MacOS, and Linux and on many hardware architectures (will be)\n- Queries over **https** using [hyper](https://crates.io/crates/hyper) (some existing exporters don't).\n  - Doesn't require openssl to be installed, allowing it to be used on weird architectures, because it uses [hyper_rustls](https://crates.io/crates/hyper_rustls).\n- Is panic-free.\n\n### Usage\n\nSee the [library docs](https://docs.rs/openweathermap_client) for example usage. To obtain an OpenWeatherMap API Key, see [this section](#getting-an-openweathermap-api-key).\n\n---\n\n## openweathermap_exporter\n\n[docs.rs](https://docs.rs/openweathermap_exporter) | [crates.io](https://crates.io/crates/openweathermap_exporter)\n\nThe `openweathermap_exporter` is a prometheus exporter to query weather readings for many locations and publis their values in as metrics prometheus exposition format.\n\nThis uses [openweathermap_client](#openweathermap_client)☝ to query weather from the API.\n\n### Installation\n\nCurrently, no binaries or container images are being built. The only way to install it (assuming you have rust [already installed](https://www.rust-lang.org/tools/install)) is via:\n\n```\ncargo install openweathermap_exporter\n```\n\nAutomatic, building of\n\n- release binaries (to be manually installed, cargo binstalled, or packaged)\n- cross-platform container images\n\nis in the works as are several [other features](https://github.com/evaneaston/openweathermap/issues).\n\n### Get An API Key\n\nTo obtain an OpenWeatherMap API Key, see [this section](#getting-an-openweathermap-api-key).\n\n### Create A Config File\n\nCreate a config file. Start with the the template below (also available in source [here](./exporter/owm_exporter-template.yaml) )\nThis file should be named `owm_exporter.yaml` and placed in the working directory from where you plan to run the exporter or in the user's home (`~/` ,  `%USERPROFILE%`) directory.\n\n```yaml\n#listen:\n#  address: localhost  # Defaults to localhost.  Can be omitted and specified in the environment variable LISTEN_ADDRESS.\n#  port: 9001          # Defaults to 9001.  Can be omitted and specified in the environment variable LISTEN_PORT.\n\nowm:\n  api_key:             # You must provide a an api key.  Can be omitted from this file and specified in the environment variable API_KEY.\n#  units: metric       # metric is the default\n#  language: en        # en is the default\n\n# The exporter doesn't currently warn if the duration of all the calls exceeds the duration\n# of `poll_interval_seconds`.  It's up to you to reconfigure so that all readings can be read\n# withing the `poll_interval_seconds` timeframe.  This will probably be updated in a future\n# release.\n\n#poll_interval_seconds: 60\n#max_calls_per_minute: 60\n\ncities:\n  - name: Bangkok\n    country_code: TH\n  - name: New York, NY\n    country_code: US\n\ncoordinates:\n  - lat: -0.829278\n    lon: -90.982067\n    display_name: The Galapagos\n\nlocations:\n  - id: 3936456\n```\n\n### Run The Exporter\n\nBy default the exporter is pretty quiet. It uses [env_logger](https://crates.io/crates/env_logger) to control the log level.\n\nWhen first using the exporter, consider running with `info` or `debug` level\n\n```\nRUST_LOG=info cargo run\n```\n\nAvailable log levels are `error`, `warn`, `info`, `debug`, `trace`.\n\n### Verify Metrics Are Published\n\nAll metrics returned by the free v2.5 API will be exported for scraping. At the moment any route will suffice to load the metrics. If you have not changed the default listen options you can test the your running instance with:\n\n```\ncurl http://localhost:9001/\n```\n\n### Metric Names\n\nBecause metric names [are encouraged](https://prometheus.io/docs/practices/naming/) to contain unit names:\n\n\u003e A metric name...\n\u003e\n\u003e - ...should have a suffix describing the unit\n\n`openweathermap_exporter` metrics all include the unit of the measurement in their name and HELP text. If you change the setting for `owm.units` in your config file, the names of the metrics and their HELP text will change accordingly.\n\nSee [Example Of Metric Names](#example-of-metric-names) to see how they're named and what information is available in the labels.\n\n### Example Dashboard\n\nI don't have a generalized dashboard template ready yet. But will share one soon. This is what my weather dashboard looks like:\n\n![weather-dashboard](./weather-dashboard.jpg)\n\n### Example Of Metric Names\n\nThis is a scrape using the [example template config file](./exporter/owm_exporter-template.yaml).\n\n```rust\n# HELP owm_cloudiness_percent % cloudiness\n# TYPE owm_cloudiness_percent gauge\nowm_cloudiness_percent{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 0\nowm_cloudiness_percent{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 100\nowm_cloudiness_percent{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 96\nowm_cloudiness_percent{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 100\n\n# HELP owm_temperature_degrees_celsius Temperature in Â°C\n# TYPE owm_temperature_degrees_celsius gauge\nowm_temperature_degrees_celsius{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 26.1\nowm_temperature_degrees_celsius{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 18.28\nowm_temperature_degrees_celsius{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 27.76\nowm_temperature_degrees_celsius{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 16.02\n\n# HELP owm_humidity_percent % Humidity\n# TYPE owm_humidity_percent gauge\nowm_humidity_percent{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 83\nowm_humidity_percent{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 79\nowm_humidity_percent{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 76\nowm_humidity_percent{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 56\n\n# HELP owm_temperature_feels_like_degrees_celsius Perceived temperature in Â°C\n# TYPE owm_temperature_feels_like_degrees_celsius gauge\nowm_temperature_feels_like_degrees_celsius{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 18.15\nowm_temperature_feels_like_degrees_celsius{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 15.14\nowm_temperature_feels_like_degrees_celsius{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 31.93\nowm_temperature_feels_like_degrees_celsius{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 26.1\n\n# HELP owm_wind_speed_meters_per_second Wind speed in meters/second\n# TYPE owm_wind_speed_meters_per_second gauge\nowm_wind_speed_meters_per_second{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 8.75\nowm_wind_speed_meters_per_second{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 0.08\nowm_wind_speed_meters_per_second{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 5.8\nowm_wind_speed_meters_per_second{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 2.57\n\n# HELP owm_visibility_meters Visibility in meters, 10000 max\n# TYPE owm_visibility_meters gauge\nowm_visibility_meters{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 10000\nowm_visibility_meters{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 10000\nowm_visibility_meters{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 10000\nowm_visibility_meters{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 3882\n\n# HELP owm_wind_direction_degrees Wind direction in degrees (0-360)\n# TYPE owm_wind_direction_degrees gauge\nowm_wind_direction_degrees{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 178\nowm_wind_direction_degrees{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 330\nowm_wind_direction_degrees{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 250\nowm_wind_direction_degrees{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 196\n\n# HELP owm_timestamp_seconds Timestamp of last reading in seconds since UNIX epoch\n# TYPE owm_timestamp_seconds gauge\nowm_timestamp_seconds{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 1666883173\nowm_timestamp_seconds{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 1666883459\nowm_timestamp_seconds{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 1666883199\nowm_timestamp_seconds{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 1666883178\n\n# HELP owm_pressure_hpa Atmospheric pressure in hPa\n# TYPE owm_pressure_hpa gauge\nowm_pressure_hpa{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 1010\nowm_pressure_hpa{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 1011\nowm_pressure_hpa{location=\"Lima\",id=\"3936456\",reading_id=\"3936456\",reading_lat=\"-12.0432\",reading_lon=\"-77.0282\",reading_name=\"Lima\"} 990\nowm_pressure_hpa{location=\"New York\",q=\"New York, NY,US\",reading_id=\"5128581\",reading_lat=\"40.7143\",reading_lon=\"-74.006\",reading_name=\"New York\"} 1019\n\n# HELP owm_wind_gust_meters_per_second Wind gust speed in meters/second\n# TYPE owm_wind_gust_meters_per_second gauge\nowm_wind_gust_meters_per_second{location=\"The Galapagos\",lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\",reading_id=\"6295630\",reading_lat=\"-0.8293\",reading_lon=\"-0.8293\",reading_name=\"Globe\"} 5.96\nowm_wind_gust_meters_per_second{location=\"Bangkok\",q=\"Bangkok,TH\",reading_id=\"1609350\",reading_lat=\"13.75\",reading_lon=\"100.5167\",reading_name=\"Bangkok\"} 0.31\n\n# HELP owm_query_success Whether the most recent query for a location's weather succeeded (0 or 1)\n# TYPE owm_query_success gauge\nowm_query_success{q=\"New York, NY,US\"} 1\nowm_query_success{q=\"Bangkok,TH\"} 1\nowm_query_success{lat=\"-0.829278\",lon=\"-0.829278\",display_name=\"The Galapagos\"} 1\nowm_query_success{id=\"3936456\"} 1\n\n# HELP owm_api_call_time_milliseconds Histogram of successful call times per location in milliseconds\n# TYPE owm_api_call_time_milliseconds summary\nowm_api_call_time_milliseconds{quantile=\"0\"} 59\nowm_api_call_time_milliseconds{quantile=\"0.5\"} 58.997791357811785\nowm_api_call_time_milliseconds{quantile=\"0.9\"} 61.99786870677149\nowm_api_call_time_milliseconds{quantile=\"0.95\"} 61.99786870677149\nowm_api_call_time_milliseconds{quantile=\"0.99\"} 61.99786870677149\nowm_api_call_time_milliseconds{quantile=\"0.999\"} 61.99786870677149\nowm_api_call_time_milliseconds{quantile=\"1\"} 65\nowm_api_call_time_milliseconds_sum 1941\nowm_api_call_time_milliseconds_count 20\n```\n\n## Getting An OpenWeatherMap API Key\n\nTo obtain an API key, go to [https://openweathermap.org/home/sign_in](https://openweathermap.org/home/sign_in) to sign in or create an account. Once logged in, select your user name from the top-right menu bar and then **My API Keys**. Use the **Create key** form to create a new key.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevaneaston%2Fopenweathermap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevaneaston%2Fopenweathermap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevaneaston%2Fopenweathermap/lists"}