dirsigler / astronauts-exporter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ISS Astronauts Exporter

This project contains a Prometheus Exporter written in Golang to learn the basic to create custom Exporter. Goal is to fetch remote data and get the current number of Astronauts stationed on the ISS.

The total number of Astronauts is then exported as a custom Prometheus metric.

Requirements

Getting started

Clone the project into your local workspace.

Set a environment variable for the API endpoint we call export NASA_ENDPOINT="http://api.open-notify.org/astros.json"

Run the Golang project go run main.go

Open the Prometheus Metrics page of the project: open http://localhost:9141/metrics

Check the custom Prometheus Exporter Metric under the configured $Namespace+MetricName: my_custom_exporter_count_nasa_astronauts_total

$ curl -sS http://localhost:9141/metrics | grep "my_custom_exporter_count_nasa_astronauts_total"
# HELP my_custom_exporter_count_nasa_astronauts_total Count of Astronauts currently on ISS.
# TYPE my_custom_exporter_count_nasa_astronauts_total counter
my_custom_exporter_count_nasa_astronauts_total 10

Inspiration