ec2_sd_configs for multiple exporters

355 views
Skip to first unread message

srini_at_work

unread,
Jan 31, 2020, 11:46:22 AM1/31/20
to Prometheus Users
hello pro-me-the-us,

We have got ec2_sd_configs workring for tracing node exporter metrics on port 9100 with below configuration.

- job_name: test
  honor_timestamps: true
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  ec2_sd_configs:
  - endpoint: ""
    region: ****
    role_arn: ****
    refresh_interval: 1m
    port: 9100
    filters: []
   
We have not added other exporters exposing metrics on another port for ex: 9404. Now is there any easy way, I can provide multiple port in same job configuration or only way is to copy the above configuration with different job name just change port? it looks very redundant, but trying to find out if that is the only way to do it?

Thanks for your help and input!

srini_at_work

unread,
Jan 31, 2020, 7:04:33 PM1/31/20
to Prometheus Users
in-short we are doing this now, to trace the metrics from two different exporters from same account:
Only the difference in both job configurations are - port numbers. Can we have multiple ports defined in same job usinng ec2_sd_configs?

- job_name: test-exporter-1
  honor_timestamps: true
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  ec2_sd_configs:
  - endpoint: ""
    region: ****
    role_arn: ****
    refresh_interval: 1m
    port: 9100
    filters: []

- job_name: test-exporter-2
  honor_timestamps: true
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  ec2_sd_configs:
  - endpoint: ""
    region: ****
    role_arn: ****
    refresh_interval: 1m
    port: 9404
    filters: []


Julien Pivotto

unread,
Feb 1, 2020, 8:43:24 AM2/1/20
to srini_at_work, Prometheus Users
On 31 Jan 16:04, srini_at_work wrote:
> in-short we are doing this now, to trace the metrics from two different
> exporters from same account:
> Only the difference in both job configurations are - port numbers. Can we
> have multiple ports defined in same job usinng ec2_sd_configs?

hello,

You should reuse ec2_sd_configs, so that you reduce the api
calls, as prometheus will reuse it.


- job_name: test-exporter-1
metrics_path: /metrics
scheme: http
ec2_sd_configs: &ec2config
- endpoint: ""
region: ****
role_arn: ****
refresh_interval: 1m
relabel_config:
- target_label: __address__
source_labels: [__meta_ec2_private_ip]
replace: "${1}:9400"
- job_name: test-exporter-1
metrics_path: /metrics
scheme: http
ec2_sd_configs: *ec2config
relabel_config:
- target_label: __address__
source_labels: [__meta_ec2_private_ip]
replace: "${1}:9401"

>
> - *job_name: test-exporter-1*
> honor_timestamps: true
> scrape_interval: 15s
> scrape_timeout: 10s
> metrics_path: /metrics
> scheme: http
> ec2_sd_configs:
> - endpoint: ""
> region: ****
> role_arn: ****
> refresh_interval: 1m
> *port: 9100*
> filters: []
>
> - *job_name: test-exporter-2*
> honor_timestamps: true
> scrape_interval: 15s
> scrape_timeout: 10s
> metrics_path: /metrics
> scheme: http
> ec2_sd_configs:
> - endpoint: ""
> region: ****
> role_arn: ****
> refresh_interval: 1m
> *port: 9404*
> filters: []
>
>
>
>
> On Friday, January 31, 2020 at 9:46:22 AM UTC-7, srini_at_work wrote:
> >
> > hello pro-me-the-us,
> >
> > We have got ec2_sd_configs workring for tracing node exporter metrics on
> > port 9100 with below configuration.
> >
> > - job_name: test
> > honor_timestamps: true
> > scrape_interval: 15s
> > scrape_timeout: 10s
> > metrics_path: /metrics
> > scheme: http
> > ec2_sd_configs:
> > - endpoint: ""
> > region: ****
> > role_arn: ****
> > refresh_interval: 1m
> > port: 9100
> > filters: []
> >
> > We have not added other exporters exposing metrics on another port for ex:
> > 9404. Now is there any easy way, I can provide multiple port in same job
> > configuration or only way is to copy the above configuration with different
> > job name just change port? it looks very redundant, but trying to find out
> > if that is the only way to do it?
> >
> > Thanks for your help and input!
> >
>
> --
> 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 prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/05921295-5311-40b4-b81a-cb52e33151b7%40googlegroups.com.


--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc

srini_at_work

unread,
Feb 2, 2020, 12:13:30 AM2/2/20
to Prometheus Users
hi Julien,

That is great, it reduces the AWS api calls. So in this case we have to define two different jobs for two different ports, but ec2 sd configs are re-used. Is there anyway we can achieve this through defining just one job and tracing from two different ports!?

Thanks!
> To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages