Skip to content

A python prometheus exporter which collect data from Open Weather's API

License

Notifications You must be signed in to change notification settings

reimlima/openweather_exporter

Repository files navigation

openweather_exporter

A python prometheus exporter which collect data from Open Weather's API

Badges

python pylint-score

Requirements

  • python >= 3.7
  • Open Weather API Key

Resolving Dependencies

pip3 install -r requirements.txt

Config File

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

Prometheus Configuration

Add the job below to your Prometheus Configuration File to scrape the app metrics

Open Weather

- 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

Grafana Dashboard

Import the file "openweather_dashboard.json" to your Grafana.

Maintainer

Reinaldo Lima

License

See LICENSE file

Acknowledgments

About

A python prometheus exporter which collect data from Open Weather's API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages