Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does file_sd_configs work? #523

Open
ghost opened this issue Feb 9, 2021 · 2 comments
Open

How does file_sd_configs work? #523

ghost opened this issue Feb 9, 2021 · 2 comments
Labels
docs Improvements or additions to documentation

Comments

@ghost
Copy link

ghost commented Feb 9, 2021

Hi,

I have a docker instance of Prometheus and I am trying to recreate the config in Puppet. I am having difficulty understanding and implementing the file_sd_configs parameter. how can I define the following for a Prometheus node:

file_sd_configs:
      - files:
        - targets.json
        - puppet_targets.json

Contents:
[
  {
    "targets": [ "rbp01.Domain.com:9100" ],
    "labels": {
      "job": "node"
    }   
  },  
  {
    "targets": [ "rbp02.Domain.com:9100" ],
    "labels": {
      "job": "node"
    }   
  }, 
],

the above is what I currently use in my docker instance when creating those files manually under /etc/prometheus/file_sd_configs they are purged/removed on the next Puppet run

Unfortunately what I am trying to do is not documented

@abctaylor
Copy link

+1 for this being properly documented

@abctaylor
Copy link

For anyone who needs a solution:

node /^prometheus\d+-lon.core.example.net$/ {

  class { 'prometheus::server':
  version        => '2.4.3',

  global_config  => {
      'external_labels'     => {
        'monitor' => 'cluster',
        'prometheus_replica' => $trusted['hostname']
        },
  },
  scrape_configs => [
    {
      'job_name'        => 'linux_dmz_vm',
      'scrape_interval' => '10s',
      'scrape_timeout'  => '10s',
      'file_sd_configs'  => [
        { 'files' => [ '/etc/prometheus/linux_dmz_vm.yaml' ], }
      ],
    },
  ],
}

@TheMeier TheMeier added the docs Improvements or additions to documentation label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants