How to create a simple Prometheus exporter?
There are often scenarios when you need to build something custom on Prometheus. An example on a simple exporter(plugin) for Prometheus.
Last updated
There are often scenarios when you need to build something custom on Prometheus. An example on a simple exporter(plugin) for Prometheus.
Last updated
The simplest way is just to create an API with the /metrics
route that will serve your metrics to Prometheus in a typical way. Your API get a response should look like this:
Where # HELP
is your metric name and some brief description of your metric, # TYPE
it is the type of the metric(), and the last row is the value of your metric.
To configure your Prometheus to read from this API(let's imagine it runs locally on a 3000 port), add the next configuration to your Prometheus server:
You can also use already existing libraries and frameworks for this purpose. A nice example of a library like this is for NodeJS.