A docker container for running a prometheus weather_exporter using Dark Sky API. It exports current weather for a list of cities. Demo
weather_exporter
can be configured via json file, environment, and/or commandline.
Configuration option names are the same across all methods. Environment variables MUST BE CAPITALIZED.
config
: path to a json config file.dark_sky_api_key
: API key to query with. REQUIRED.dark_sky_api_uri
: URL of the darksky.net api (version as of 10/10/2017). Defaults tohttps://api.darksky.net/forecast
.scrape_interval
: how often to poll darksky.net for data in seconds. Defaults to600
seconds.endpoint_port
: what port to exposeweather_exporter
on. Defaults to9265
.cities
: comma-separated list of cities as understood byNominatim
. Defaults to "nyc,tokyo,lima,london,shanghai
".geocode_timeout
: timeout in seconds on api calls toNominatim
. Defaults to10
seconds.units
: unit of the weather data. See Dark Sky API Docs for a list of valid units. Defaults tous
(imperial units).
$ export DARK_SKY_API_KEY=<dark_ski_api_key>
# ENV Variables
ENDPOINT_PORT=9265
CITIES=nyc,portland or,london
SCRAPE_INTERVAL=10000
$ make up
scrape_configs:
- job_name: weather_exporter
metrics_path: /
static_configs:
- targets:
- '172.17.0.1:9265'
labels:
alias: 'weather-exporter'
$ make push
$ export DARK_SKY_API_KEY=<dark_ski_api_key>
$ make deploy
$ export POD_NAME=$(kubectl get pods --namespace weather-exporter -l "app=weather-exporter,release=weather-exporter" -o jsonpath="{.items[0].metadata.name}")
$ kubectl port-forward --namespace weather-exporter $POD_NAME 9265:9265
In a browser, open 127.0.0.1:9265
$ make delete