Maybe you've misunderstood scraping and federation.
Prometheus scrapes are "pulls". When a prometheus scrape job runs, it
makes an outbound HTTP connection to a remote server (an "exporter") and
reads back metrics from it. So in your example here:
31 - job_name: 'prom'$
32 metrics_path: '/'$
33 static_configs:$
34 - targets: ['localhost:12156']$
prometheus periodically connects to localhost port 12156, and whatever is
listening on that port is a prometheus "exporter" which responds with
metrics. You can also talk to it like this:
curl localhost:12156
and that server will respond with lines of the form
metricname{label="value",...} value
These are what prometheus ingests into its timeseries database. No data is
sent *from* prometheus to the exporter.
Federation is a special case of scraping: it's when one prometheus server
scrapes the /federate endpoint of another prometheus server, to read out
metrics which that server has already collected. (For example: a central
aggregation server is scraping the /federate endpoint of remote servers in
other data centres).
Therefore, you would only configure your own prometheus server to scrape a
/federate endpoint when you need to scrape metrics out of another, remote
prometheus server.
So this makes no sense:
24 - job_name: 'federate'$
25 metrics_path: '/federate'$
26 params:~$
27 'match[]':$
28 - '{job="prom"}'$
29 static_configs:$
30 - targets: ['localhost:9090']$
Here you're trying to scrape your own /federate endpoint, which means
collecting data from yourself and writing it back to yourself.
The original question was: how do you get data from prometheus to datadog?
I don't know: it depends on what interface(s) datadog provides for
collecting/ingesting data, and datadog is a commercial cloud-hosted
service. (Perhaps their technical support can help?)
However you said originally: *"I know that we need to make changes in
datadog's conf file present in openmetrics.d directory. But as Prometheus
only shows metrics about it's own server on /metrics. How can we send them
to datadog?"*
If datadog's agent is able to scrape an exporter, then point it at your
/federate?match=... endpoint rather than your /metrics endpoint.
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/550ccd40-7309-4cf6-a438-b209c6ca0ecc%40googlegroups.com.