A python prometheus exporter which collect data from Open Weather's API
- python >= 3.7
- Open Weather API Key
pip3 install -r requirements.txt
You have to fill these fields in the YAML Config File before your first run:
Field | Description |
---|---|
api_key | Your api key |
cities | List of city ID's from the cities you want to collect data |
⚠️ You have to find those ID's in the City List available in the Open Weather's website.
Option | Mandatory? | Description |
---|---|---|
-p, --port | No. Default: 8080 | App Port |
-c, --config | Yes | Path to Config File |
-h, --help | No | Show help like below |
# openweather_exporter
usage: openweather_exporter [-h] [-p [PORT]] [-c CONFIG]
optional arguments:
-h, --help show this help message and exit
-p [PORT], --port [PORT]
Port, default: 8080
-c CONFIG, --config CONFIG
Path to config file
Add the job below to your Prometheus Configuration File to scrape the app metrics
- job_name: 'open_weather'
scheme: http # change to http if you don't have https
metrics_path: '/metrics'
static_configs:
- targets:
- mytarget
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:8080 # Change here with your real exporter address:port
Import the file "openweather_dashboard.json" to your Grafana.
See LICENSE file
- Rauklei Guimarães: With any stupid quetion I have related to python things.
- Mr_and_Mrs_D: For show how to deal with command line default options.
- Thomas Stringer: For show how to log stuff to systemd