
Introduction
I originally setup a Grafana dashboard to monitor my Unraid server back in 2024. It worked well, but suffered from latency issues during high IO usage. Because of that I never really used it. But recently I came up with the idea to create my own weather dashboard. The idea wasn’t so much for practicality but to visualize weather trends in my area and have pretty graphs.
Prerequisites
The setup for this is relativity simple if you already have a functioning Grafana instance with Prometheus. The only additional requirements are a Openweathermap V3.0 API key and Openweather-Exporter by Billywkwooten. The docker hub for this can be found here.
Since my Grafana is already configured I will not cover what I had to do to make that work.
Openweathermap API
Before beginning you must sign up for an account on Openweathermap.org. Once created you will be assigned and API key. Before it can be used you need sign up for a V3.0 API subscription. (Note, a V4.0 API will return errors.)This requires you to input a billing method, but as long as you stay below the daily query threshold there is no cost. The exporter wont exceed it by default so you don’t have to worry about exceeding this.
The API takes some time to become active. You can test your key it see if its active using the URL below. Just input your API key and paste it intro a browser. It will return an error if its not yet active. Mine took about 15 minutes.
http://api.openweathermap.org/data/3.0/onecall?lat=30.489772&lon=-99.771335&appid={API KEY HERE}
Installation of Openweather-Exporter
Once you have a working API key you can install the exporter. Since this container is not listed on the Community Applications page it needs be installed manually. Normally I would do this by creating a template, but I had issues getting this container to run properly so I resorted using docker run. I used the command below to compile my container. It required no other changes.
# Export weather metrics from Seattle using dockerdocker run -d --restart on-failure --name=openweather-exporter -p 9091:9091 billykwooten/openweather-exporter --city "Seattle, WA" --enable-pol --apikey {API Key}
For some reason when I attempted to change the port in the terminal logs it said it was still using 9091. Something then caused my container to be unreachable by Prometheus. So I just configured it to use 9091 and removed my conflicting container config. To test your exporter you can navigate to it in your browser at http://{ServerIP}:9091/metrics. As long as a error is not returned you should be good. If the page does not work or your container keeps rebooting, refer to the logs window. The only errors I ran into personally were a mismatched port number in the logs and an error about a missing/inactive API key.
Tie Openweather into Prometheus
Now that you have your exporter configured we can scrape that information into Prometheus. Since I already had a working Prometheus config, it was as simple as adding the target to my scrape config. I used the config below for my YAML. I initially added a metrics_path of /metrics but found it to not be necessary.
scrape_configs: - job_name: 'openweather-exporter' scrape_interval: 10s static_configs: - targets: ['ServerIP:9091']
Once your YAML is saved you can restart Prometheus and go to your targets page. You should be able to see it listed under your targets. There you can click the URL to see if it works. If it does not work, Prometheus wont be able to scan it.
Grafana Visualizations
Now we are finally get to the part where we get to make a bunch of pretty visualizations. This part is very dependent on what you want to show and how.

Calling metrics is pretty self explanatory unlike some other dashboards that show computer utilization etc. Because OpenWeather returns pre-processed data you just have to call the metric and it shows as expected. They all start follow a naming scheme like “openweather_(metric type here) or if its a pollution stat they are “openweather_pollution_(metric type here).
Conclusion
Overall I’m very happy with how this dashboard turned out and learned a bunch about calling APIs and data. In the future I would like to try and add a few panels that give future projected information such as precipitation and temperature projections etc. But at the moment I’m can’t pull that sort of data with openweather-exporter.

Leave a Reply