Skip to content

Commit

Permalink
Merge pull request voxpupuli#388 from alexjfisher/scrape_job_labels
Browse files Browse the repository at this point in the history
Add `scrape_job_labels` parameter to exporters
  • Loading branch information
alexjfisher authored Nov 18, 2019
2 parents 3cfec91 + 1efddb4 commit c8d2a30
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 11 deletions.
2 changes: 2 additions & 0 deletions manifests/apache_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9117,
String[1] $scrape_job_name = 'apache',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down Expand Up @@ -139,5 +140,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/beanstalkd_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 8080,
String[1] $scrape_job_name = 'beanstalkd',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down Expand Up @@ -159,5 +160,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
3 changes: 2 additions & 1 deletion manifests/blackbox_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9115,
String[1] $scrape_job_name = 'blackbox',

Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

# Prometheus added a 'v' on the release name at 0.1.0 of blackbox
Expand Down Expand Up @@ -171,5 +171,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/collectd_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9103,
String[1] $scrape_job_name = 'collectd',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -124,5 +125,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/consul_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9107,
String[1] $scrape_job_name = 'consul',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

# Prometheus added a 'v' on the realease name at 0.3.0
Expand Down Expand Up @@ -170,5 +171,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
15 changes: 8 additions & 7 deletions manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
Stdlib::Host $scrape_host = $facts['fqdn'],
Optional[Stdlib::Port] $scrape_port = undef,
String[1] $scrape_job_name = $name,
Hash $scrape_job_labels = { 'alias' => $scrape_host },
Stdlib::Absolutepath $usershell = $prometheus::usershell,
) {

Expand Down Expand Up @@ -121,14 +122,14 @@
}
}
file { "/opt/${name}-${version}.${os}-${arch}/${name}":
owner => 'root',
group => 0, # 0 instead of root because OS X uses "wheel".
mode => '0555',
owner => 'root',
group => 0, # 0 instead of root because OS X uses "wheel".
mode => '0555',
}
-> file { "${bin_dir}/${name}":
ensure => link,
notify => $notify_service,
target => "/opt/${name}-${version}.${os}-${arch}/${name}",
ensure => link,
notify => $notify_service,
target => "/opt/${name}-${version}.${os}-${arch}/${name}",
}
}
'package': {
Expand Down Expand Up @@ -269,7 +270,7 @@
@@prometheus::scrape_job { "${scrape_host}:${scrape_port}":
job_name => $scrape_job_name,
targets => ["${scrape_host}:${scrape_port}"],
labels => { 'alias' => $scrape_host },
labels => $scrape_job_labels,
}
}
}
2 changes: 2 additions & 0 deletions manifests/elasticsearch_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9114,
String[1] $scrape_job_name = 'elasticsearch',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down Expand Up @@ -154,5 +155,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/graphite_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9108,
String[1] $scrape_job_name = 'graphite',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -124,5 +125,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/haproxy_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9101,
String[1] $scrape_job_name = 'haproxy',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -134,6 +135,7 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}

}
2 changes: 2 additions & 0 deletions manifests/mesos_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9105,
String[1] $scrape_job_name = 'mesos',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -138,5 +139,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/mongodb_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9216,
String[1] $scrape_job_name = 'mongodb',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down Expand Up @@ -147,5 +148,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/mysqld_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9104,
String[1] $scrape_job_name = 'mysql',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down Expand Up @@ -179,5 +180,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/nginx_vts_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9913,
String[1] $scrape_job_name = 'nginx_vts',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -134,6 +135,7 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}

}
3 changes: 2 additions & 1 deletion manifests/node_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# [*arch*]
# Architecture (amd64 or i386)
#

# [*bin_dir*]
# Directory where binaries are located
#
Expand Down Expand Up @@ -115,6 +114,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9100,
String[1] $scrape_job_name = 'node',
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $bin_name = undef,
) inherits prometheus {

Expand Down Expand Up @@ -173,6 +173,7 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
bin_name => $bin_name,
}
}
2 changes: 2 additions & 0 deletions manifests/postgres_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9187,
String[1] $scrape_job_name = 'postgres',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$release = "v${version}"
Expand Down Expand Up @@ -219,5 +220,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/process_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9256,
String[1] $scrape_job_name = 'process',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$filename = "${package_name}-${version}.${os}-${arch}.${download_extension}"
Expand Down Expand Up @@ -143,5 +144,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/rabbitmq_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9090,
String[1] $scrape_job_name = 'rabbitmq',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url, "${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -177,5 +178,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
3 changes: 2 additions & 1 deletion manifests/redis_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# [*arch*]
# Architecture (amd64 or i386)
#

# [*bin_dir*]
# Directory where binaries are located
#
Expand Down Expand Up @@ -110,6 +109,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9121,
String[1] $scrape_job_name = 'redis',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$release = "v${version}"
Expand Down Expand Up @@ -185,5 +185,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/snmp_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9116,
String[1] $scrape_job_name = 'snmp',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -169,5 +170,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/statsd_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9102,
String[1] $scrape_job_name = 'statsd',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

# Prometheus added a 'v' on the realease name at 0.4.0 and changed the configuration format to yaml in 0.5.0
Expand Down Expand Up @@ -165,5 +166,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
2 changes: 2 additions & 0 deletions manifests/varnish_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9131,
String[1] $scrape_job_name = 'varnish',
Optional[Hash] $scrape_job_labels = undef,
) inherits prometheus {

$real_download_url = pick($download_url,"${download_url_base}/download/${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -131,5 +132,6 @@
export_scrape_job => $export_scrape_job,
scrape_port => $scrape_port,
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
}
}
Loading

0 comments on commit c8d2a30

Please sign in to comment.