🌐
Medium
medium.com › @dast04 › writing-custom-prometheus-exporters-in-python-kubernetes-73626b66d78c
Writing Custom Prometheus Exporters (in Python) — Kubernetes | by Daniello | Medium
August 22, 2024 - FROM python:3.11-alpine # This ... AWS ECR for that purpose. We have written the exporter itself using prometheus-client, dockerized the application, and pushed it to the remote repository....
🌐
Medium
medium.com › @shaharewq0 › creating-a-custom-prometheus-exporter-with-python-257b6492a0a0
Creating a Custom Prometheus Exporter with Python | by Shahar Cohen hadad | Medium
September 7, 2024 - They enable the collection of metrics that Prometheus doesn’t natively support, empowering you to gain deeper visibility into the behavior of your applications and infrastructure. To demonstrate the creation of a custom exporter, we’ll use Python along with two key libraries: the Prometheus_client library for defining and exposing metrics, and the Openshift.Dynamic library for interacting with the Openshift Container Platform API.
Discussions

FastAPI and Prometheus endpoint
You won't be able to start 2 servers/processes listening on the same port. First one to start, wins. The other will fail to bind as the port is already in use. What you could do though is start both on different ports, say 8080 and 8081 or something, then put nginx in front of it all and proxy through to which ever backend based on the requested path. As a bonus you can terminate TLS at the nginx level using a single cert etc etc too. More on reddit.com
🌐 r/FastAPI
5
1
December 16, 2022
Prometheus Middleware is out!
This is great work! Thanks for sharing Will try it out soon More on reddit.com
🌐 r/FastAPI
10
14
October 12, 2020
Is there way to deliver dataset with timestamps to prometheus
First went digg, then went reddit. RIP -- mass edited with https://redact.dev/ More on reddit.com
🌐 r/PrometheusMonitoring
4
3
September 20, 2018
write an exporter in python: basic questions, organizing metrics
try not to hardcode IPs in the exporter itself, have a seperate .env file or config.yaml to list ips to make the exporter more modular and also maybe look at netbox to add the devices there and use the netbox api to fetch the device names and its IPs so that you can add / remove devices as your environment changes and automatically the exporter would fetch the current devices without changing any exporter code. also another tip is to dockerize the exporter once you are happy with it and restrict the compute it can use in docker compose so that in case there is any memory leak etc in your exporter it wouldnt crash your host. More on reddit.com
🌐 r/PrometheusMonitoring
12
5
July 23, 2025
🌐
RTFM
rtfm.co.ua › home › monitoring › prometheus › prometheus: building a custom prometheus exporter in python
Prometheus: Building a Custom Prometheus Exporter in Python
February 25, 2023 - Currently, we use Blackbox Exporter to monitor it, but later we want to expand the capabilities a bit, so we will try to create an exporter that for now will simply check the response code of this endpoint. #!/usr/bin/env python import os import requests import time from prometheus_client import start_http_server, Enum, Histogram hitl_psql_health_status = Enum("hitl_psql_health_status", "PSQL connection health", states=["healthy", "unhealthy"]) hitl_psql_health_request_time = Histogram('hitl_psql_health_request_time', 'PSQL connection response time (seconds)') def get_metrics(): with hitl_psql_health_request_time.time(): resp = requests.get(url=os.environ['HITL_URL']) print(resp.status_code) if not (resp.status_code == 200): hitl_psql_health_status.state("unhealthy") if __name__ == '__main__': start_http_server(9000) while True: get_metrics() time.sleep(1)
🌐
Prometheus
prometheus.io › docs › instrumenting › writing_exporters
Writing exporters | Prometheus
In this case, Prometheus should still do service discovery, and pass on the target to be scraped. See the blackbox and SNMP exporters for examples. Note that it is only currently possible to write this type of exporter with the Go, Python and Java client libraries.
🌐
ITNEXT
itnext.io › prometheus-building-a-custom-prometheus-exporter-in-python-988908327600
Prometheus: Building a Custom Prometheus Exporter in Python | by Arseny Zinchenko (setevoy) | ITNEXT
May 21, 2023 - Currently, we use Blackbox Exporter to monitor it, but later we want to expand the capabilities a bit, so we will try to create an exporter that for now will simply check the response code of this endpoint. #!/usr/bin/env python import os import requests import time from prometheus_client import start_http_server, Enum, Histogram hitl_psql_health_status = Enum("hitl_psql_health_status", "PSQL connection health", states=["healthy", "unhealthy"]) hitl_psql_health_request_time = Histogram('hitl_psql_health_request_time', 'PSQL connection response time (seconds)') def get_metrics(): with hitl_psql_health_request_time.time(): resp = requests.get(url=os.environ['HITL_URL']) print(resp.status_code) if not (resp.status_code == 200): hitl_psql_health_status.state("unhealthy") if __name__ == '__main__': start_http_server(9000) while True: get_metrics() time.sleep(1)
🌐
Medium
medium.com › globant › creating-a-prometheus-custom-exporter-using-python-and-adding-it-using-service-discovery-b43be8c875af
Creating a Prometheus Custom Exporter Using Python and Adding It Using Service Discovery | by Suyog Kulkarni | Globant | Medium
December 6, 2024 - Set up the environment (e.g., ports to expose, entry points). FROM --platform=linux/amd64 python:3.8-slim-buster as build WORKDIR /app RUN pip3 install prometheus_client COPY custom_exporter.py .
🌐
SysOpsPro
sysopspro.com › home › building a custom prometheus exporter in python
Building a Custom Prometheus Exporter in Python - SysOpsPro
July 13, 2024 - In this tutorial, you will learn the process of developing a custom Prometheus Exporter in Python. We will create an exporter to monitor an API endpoint and expose selected data as Prometheus metrics.
🌐
OneUptime
oneuptime.com › home › blog › how to build custom exporters for prometheus
How to Build Custom Exporters for Prometheus
December 5, 2025 - Include a health check - Helps with monitoring the exporter itself · Use appropriate metric types - Counter, Gauge, Histogram, Summary · Follow naming conventions - namespace_subsystem_name_unit · Include useful labels - But avoid high cardinality · package main import ( "log" "net/http" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) // Collector implements prometheus.Collector interface type MyCollector struct { upMetric *prometheus.Desc requestsMetric *prometheus.Desc latencyMetric *prometheus.Desc } func NewMyCollector() *MyC
Find elsewhere
🌐
Thomas Stringer
trstringer.com › quick-and-easy-prometheus-exporter
Create a Quick and Easy Prometheus Exporter | Thomas Stringer
January 3, 2021 - Let’s see a small but complete exporter implemented in Python (notes and explanation in comments and below the snippet): ... In the above code, I defined a helper class AppMetrics to contain the Prometheus metrics and app metric loop logic. Creating the class wasn’t necessary, but I think it is a bit cleaner and more future-proof to start this way and keep the logic and data contained in an object.
🌐
Ashish
ashish.one › blogs › [part 3] how to write custom prometheus exporter?
[Part 3] How to write custom prometheus exporter? | ashish.one
May 11, 2022 - Like below: It exposes the data on a specific port e.g http://myurl:8000. Let’s take a very basic example, Suppose there is one script (Daemon service) is running with the name myprocess.go.
🌐
Better Programming
betterprogramming.pub › create-your-pythons-custom-prometheus-exporter-abb156e0d145
Create Your Python’s Custom Prometheus Exporter | by Geoffrey Mariette | Better Programming
September 13, 2022 - Despite all the exporters (https://prometheus.io/docs/instrumenting/exporters/) that Prometheus and its community can offer, in some particular use cases, you may want to design your own exporter to run your custom checks. No worries, Prometheus has got you covered! If you check this GitHub repository, you will find a Python Prometheus client that you can use and abuse to build up your exporter.
🌐
rokpoto
rokpoto.com › home › blog › how to create and debug custom python prometheus exporter
How to create and debug custom Python Prometheus exporter | rokpoto
February 11, 2023 - In fact, it’s very easy to build a new Prometheus exporter using Prometheus python client. Therefore, we’ll develop custom Prometheus exporter in Python and show how to debug it fast.
🌐
MetricFire
metricfire.com › blog › first-contact-with-prometheus
First Contact with Prometheus Exporters | MetricFire
May 27, 2024 - In this article, we first discussed the basic concepts of Prometheus exporters and then went through two documented examples of implementation using Python. Those examples leverage Prometheus’s best practices and serve as a starting point for building your exporters according to your specific application needs.
🌐
Medium
ikod.medium.com › custom-exporter-with-prometheus-b1c23cb24e7a
Custom Exporter with Prometheus. Prometheus is an excellent tool for… | by Jakir Patel | Medium
June 8, 2023 - In the exporter, we will have gauge and counter metrics exposed. For this, I ‘ll use the prometheus_client to import the libraries. I have the repository on Github you can check it here. ... Writing the custom exporter in python for Prometheus.
🌐
Enix
enix.io › en › blog › create-prometheus-exporter
How to Create a Prometheus Exporter?
It’s important to note that Prometheus provides several libraries to define and expose your metrics based on the language your exporter uses: ... And other unofficial libraries can be found here. Now, let’s move on to the practical side, let’s begin by setting up a basic HTTP server. For this tutorial, I’ll use the python language and the official client library.
🌐
GitHub
github.com › a10networks › PrometheusExporter
GitHub - a10networks/PrometheusExporter: Custom python exporter for vThunder · GitHub
In this scenario, once the Prometheus server is started, it invokes a custom exporter after each 15sec, as specified in the scraping interval. api_endpoint and api_name (unique identifier for a job) are passed to the exporter as parameters.
Starred by 6 users
Forked by 13 users
Languages: Python 98.7% | Dockerfile 1.3%
🌐
Last9
last9.io › blog › best-practices-using-and-writing-prometheus-exporters
Best Practices Using and Writing Prometheus Exporters | Last9
January 25, 2026 - Access the Sample Page Once the ... simply a directory where you’ll write your exporter. For this example, the directory will be named httpd-exporter....
🌐
GitHub
github.com › albertodonato › prometheus-aioexporter
GitHub - albertodonato/prometheus-aioexporter: Asyncio library for creating Prometheus exporters · GitHub
async def on_application_startup(self, application: aiohttp.web.Application) -> None: # ... application[EXPORTER_APP_KEY].set_metric_update_handler(self._update_handler) async def _update_handler(self, metrics: dict[str, prometheus_client.metrics.MetricWrapperBase]): for name, metric in metrics.items(): metric.set(...) See prometheus_aioexporter.sample for a complete example (that can be run with python -m prometheus_aioexporter.sample).
Starred by 17 users
Forked by 9 users
Languages: Python
🌐
Medium
medium.com › trendyol-tech › custom-prometheus-exporter-for-couchbase-65866cd026b9
Custom Prometheus exporter for Couchbase | by Alpay Kurbaloğlu | Trendyol Tech | Medium
February 27, 2024 - Let’s start by creating and activating a virtual env named “envcbexp” for our exporter in desired OS; python3 -m venv envcbexp source ./envcbexp/bin/activate · Secondly, we will install prometheus_client and requests to get and parse ...