Coder Social home page Coder Social logo

rkosegi / open-meteo-exporter Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 110 KB

Prometheus exporter for open-meteo.com

License: Apache License 2.0

Dockerfile 5.90% Makefile 10.40% Go 74.97% Smarty 8.73%
open-meteo prometheus-exporter weather-api

open-meteo-exporter's Introduction

Open Meteo Exporter

This is prometheus exporter for Open Meteo current conditions at particular place.

Building

Docker build

make build-docker

Local build

make build-local

Running

Here is example config.yaml:

---
locations:
  - name: Vienna
    method: alt
    latitude: 48.2082
    longitude: 16.3738

Note method field. It could be either default or alt, or omitted all together. This field controls how data are fetched and processed from API. The alt provides more details.

Start exporter locally

./owm-exporter
ts=2023-02-08T17:31:29.678Z caller=main.go:76 level=info msg="Starting openmeteo_exporter" version="(version=, branch=, revision=7a038743ac2af96be06afd015ee88aad1e9d8376-modified)" config=config.yaml
ts=2023-02-08T17:31:29.678Z caller=main.go:79 level=info msg="Build context" build_context="(go=go1.19.5, platform=linux/amd64, user=, date=)"
ts=2023-02-08T17:31:29.678Z caller=main.go:86 level=info msg="Got 1 targets"
ts=2023-02-08T17:31:29.680Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9113
ts=2023-02-08T17:31:29.680Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9113

Or using docker

docker run -ti -p 9113:9113 -v $(pwd)/config.yaml:/config.yaml:ro ghcr.io/rkosegi/open-meteo-exporter:v1.0.3

Example collector output from http://localhost:9113/metrics

# HELP openmeteo_current_temperature The current temperature.
# TYPE openmeteo_current_temperature gauge
openmeteo_current_temperature{location="Vienna"} -0.1
# HELP openmeteo_current_wind_dir The current wind direction.
# TYPE openmeteo_current_wind_dir gauge
openmeteo_current_wind_dir{location="Vienna"} 137
# HELP openmeteo_current_wind_speed The current wind speed.
# TYPE openmeteo_current_wind_speed gauge
openmeteo_current_wind_speed{location="Vienna"} 5.9
# HELP openmeteo_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which openmeteo_exporter was built, and the goos and goarch for the build.
# TYPE openmeteo_exporter_build_info gauge
openmeteo_exporter_build_info{branch="",goarch="amd64",goos="linux",goversion="go1.19.5",revision="7a038743ac2af96be06afd015ee88aad1e9d8376-modified",version=""} 1
# HELP openmeteo_exporter_http_fetch_duration Total time spent on fetching data from api.open-meteo.com
# TYPE openmeteo_exporter_http_fetch_duration summary
openmeteo_exporter_http_fetch_duration_sum 260
openmeteo_exporter_http_fetch_duration_count 1
# HELP openmeteo_exporter_http_rx_bytes Total bytes received from api.open-meteo.com
# TYPE openmeteo_exporter_http_rx_bytes counter
openmeteo_exporter_http_rx_bytes 282
# HELP openmeteo_exporter_scrape_errors Total number of times an error occurred during scraping operation.
# TYPE openmeteo_exporter_scrape_errors counter
openmeteo_exporter_scrape_errors 0
# HELP openmeteo_exporter_total_scrapes Total number of times this exporter was scraped for metrics.
# TYPE openmeteo_exporter_total_scrapes counter
openmeteo_exporter_total_scrapes 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.