prometheus-proxy icon indicating copy to clipboard operation
prometheus-proxy copied to clipboard

support include params

Open Gourds opened this issue 3 years ago • 4 comments

can support include params

in my case

scrape_configs:
  - job_name: "test"
    honor_labels: true
    file_sd_configs:
    - refresh_interval: 1m
      files:
      - "/etc/prometheus/myconfig/*.yml"

I want use config file like this , can prometheus-proxy support it ?

for example

agent {
  pathConfigs: [
     some_path_A,
     some_path_B,
  ]
}

Gourds avatar Feb 27 '23 09:02 Gourds

I am not sure what you are asking. Can you give me a few more details?

Thanks, Paul

pambrose avatar Feb 27 '23 10:02 pambrose

I don't want every single metric to be a job, I want a class of metric to be a job, and I want configuration files to be classified by different files

example

I have many exporter config,

  • node-exporter-targets.json
  • process-exporter-targets.json
  • ...

each exporter is a json file include many target

node-exporter-targets.json

   {
      name: "node-exporter"
      path: type_a_metrics
      url: "http://app1.local:9100/metrics"
    },
    {
      name: "node-exporter"
      path: type_a_metrics
      url: "http://app2.local:9100/metrics"
    },
    {
      name: "node-exporter"
      path: type_a_metrics
      url: "http://app3.local:9100/metrics"
    }

process-exporter-targets.json

   {
      name: "process-exporter"
      path: type_b_metrics
      url: "http://app1.local:9256/metrics"
    },
    {
      name: "process-exporter"
      path: type_b_metrics
      url: "http://app2.local:9256/metrics"
    },
    {
      name: "process-exporter"
      path: type_b_metrics
      url: "http://app3.local:9256/metrics"
    }

I expect prometheus-proxy can be configured like the example below

agent {
  pathConfigs: [
  	node-exporter-targets.json,
  	process-exporter-targets.json
  ]
}

and prometheus config will be as below

scrape_configs:
  - job_name: 'node-exporter'
    metrics_path: '/type_a_metrics'
    static_configs:
      - targets: [ 'mymachine.local:8080' ]
  - job_name: 'process-exporter'
    metrics_path: '/type_b_metrics
    basic_auth:
        username: 'user'
        password: 's3cr3t'
    static_configs:
      - targets: [ 'mymachine.local:8080' ]

Gourds avatar Feb 27 '23 10:02 Gourds

Sorry for taking so long to get back to you on this. I have been busy with something.

Does this summarize your request: you want to be able to embed filenames for the pathConfigs values in a conf file?

pambrose avatar Mar 13 '23 04:03 pambrose

Hey @Gourds , I am sorry for going dark on you for so long on this issue. I oursource the reading and processing of the config files to another library and that library does not support what you are asking for. However, I could add a pathConfigFiles array value and read the json files manually. Are you still in need of this functionality?

pambrose avatar Dec 10 '24 18:12 pambrose