Is it possible to use REST Service to provide data for prometheus

28 views
Skip to first unread message

Thorsten Stork

unread,
Jul 1, 2020, 11:25:22 AM7/1/20
to Prometheus Users
Hello,

I am really new to the prometheus topics, but should evaluate monitoring functionality 
for a system.

On this system (middleware) we kan provide REST Service, http-Services or webservices which can deliver some metrics at the current time (no historic data).
On this system we could not install exporter or other things like libraries or so.

How far I understand, Prometheus pulls the data from an exporter via REST oder http-call, is this right ?

So is the a definition how the service have to look like to simulate an "exporter" or my complete idea the wrong way ?

How should be the best way to solve my requirements ?

Thank you.

Regards
   Thorsten

Christian Hoffmann

unread,
Jul 1, 2020, 12:00:35 PM7/1/20
to Thorsten Stork, Prometheus Users
Hi,

On 7/1/20 5:25 PM, Thorsten Stork wrote:
> I am really new to the prometheus topics, but should evaluate monitoring
> functionality 
> for a system.
>
> On this system (middleware) we kan provide REST Service, http-Services
> or webservices which can deliver some metrics at the current time (no
> historic data).
> On this system we could not install exporter or other things like
> libraries or so.
>
> How far I understand, Prometheus pulls the data from an exporter via
> REST oder http-call, is this right ?
Right, it's just a simple HTTP GET request which returns the metrics in
a defined format.

> So is the a definition how the service have to look like to simulate an
> "exporter" or my complete idea the wrong way ?
No need to "simulate". It's a completely valid way. :)

Depending on your environment and the programming language, it might be
easier to use one of the existing client libraries for that.

This documentation describes the format:
https://prometheus.io/docs/instrumenting/exposition_formats/

Kind regards,
Christian

Thorsten Stork

unread,
Jul 1, 2020, 12:21:08 PM7/1/20
to Prometheus Users
Thank you very much. I will try it out.

Thorsten Stork

unread,
Jul 2, 2020, 2:15:52 AM7/2/20
to Prometheus Users
Hi Christian, 

another question to this: How/where will the endpoint of my REST service configured, so prometheus will call ist it and get the values at the actual time ?

Thank you.

Regards
   Thorsten

Am Mittwoch, 1. Juli 2020 17:25:22 UTC+2 schrieb Thorsten Stork:

Christian Hoffmann

unread,
Jul 2, 2020, 8:30:45 AM7/2/20
to Thorsten Stork, Prometheus Users
Hi,

On 7/2/20 8:15 AM, Thorsten Stork wrote:
> another question to this: How/where will the endpoint of my REST service
> configured, so prometheus will call ist it and get the values at the
> actual time ?

That's the scrape configuration.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config

The simplest form is the static service discovery:
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config

The path defaults to /metrics, but can be changed (metrics_path).

Kind regards,
Christian
Reply all
Reply to author
Forward
0 new messages