You can't get prometheus to connect to a remote system to "push" metrics 
[except using the remote_write functionality, which is a specific protocol 
the remote system needs to support]

However, other servers can scrape or "pull" metrics from prometheus, by 
scraping the /federate endpoint.  That is: you can configure datadog's 
agent to scrape prometheus' /federate endpoint.

The first thing to do is, make sure you scrape the /federate endpoint 
manually using curl. Try something like this:

curl '127.0.0.1:9090/federate?match%5b%5d=%7bjob%3d"node"%7d'

Yes it's ugly, because of URL escaping.  That example uses query 
{job="node"}, escaped as follows:

= -> %3d
[ -> %5b
] -> %5d
{ -> %7b
} -> %7d

If course, if you don't have any metrics labeled with job="node" then 
you'll have to amend this as appropriate.  To scrape absolutely everything 
(which probably isn't a good idea), use:

curl 'prometheus:9090/federate?match%5b%5d=%7b__name__%3d%7e".*"%7d'

When that's working, turn your attention to datadog to get it to do the 
same scraping.  According to this post 
<https://www.datadoghq.com/blog/monitor-prometheus-metrics/> it should be 
possible.  I haven't tested it (since I don't use datadog), but you can try:

instances:
  # The prometheus endpoint to query from
  - prometheus_url: 
http://targethost:9090/federate?match%5b%5d=%7bjob%3d"node"%7d
    namespace: "my_prometheus"
    metrics:
      - "*"


This may need adjusting depending on whether datadog does its own escaping 
of URLs.  If you can't make it work, then since you're using a commercial 
service, I suggest you talk to their technical support - that's what you're 
paying for after all.

What you showed before was configuring prometheus to scrape its own 
/federate endpoint, and that doesn't make sense.

-- 
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/6395932a-fc09-4356-937f-50c49f73c1a6%40googlegroups.com.

Reply via email to