diff --git a/site-modules/profile/manifests/prometheus/export_scrape_config.pp b/site-modules/profile/manifests/prometheus/export_scrape_config.pp index 901aa9fe..e828c522 100644 --- a/site-modules/profile/manifests/prometheus/export_scrape_config.pp +++ b/site-modules/profile/manifests/prometheus/export_scrape_config.pp @@ -1,17 +1,21 @@ # Export a scrape config to the configured prometheus server define profile::prometheus::export_scrape_config ( String $target, String $job = $name, Optional[String] $prometheus_server = undef, Hash[String, String] $labels = {}, + Enum['http', 'https'] $scheme = 'http', + String $metrics_path = '/metrics', ) { $static_labels = lookup('prometheus::static_labels', Hash) @@profile::prometheus::scrape_config {"${facts['swh_hostname']['short']}_${name}": prometheus_server => pick($prometheus_server, lookup('prometheus::server::certname')), target => $target, job => $job, labels => $static_labels + $labels, + scheme => $scheme, + metrics_path => $metrics_path, } } diff --git a/site-modules/profile/manifests/prometheus/scrape_config.pp b/site-modules/profile/manifests/prometheus/scrape_config.pp index 314fdaef..f5540911 100644 --- a/site-modules/profile/manifests/prometheus/scrape_config.pp +++ b/site-modules/profile/manifests/prometheus/scrape_config.pp @@ -1,26 +1,29 @@ # Scrape configuration for a prometheus exporter define profile::prometheus::scrape_config ( String $prometheus_server, String $target, String $job, Hash[String, String] $labels = {}, - + Enum['http', 'https'] $scheme = 'http', + String $metrics_path = '/metrics', ){ $directory = $profile::prometheus::server::scrape_configs_dir file {"${directory}/${name}.yaml": ensure => 'present', owner => 'root', group => 'root', mode => '0644', content => inline_yaml( [ { - targets => [$target], - labels => { + targets => [$target], + labels => { job => $job, } + $labels, + scheme => $scheme, + metrics_path => $metrics_path, }, ] ), } }