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

WIP: add labeling support for exported scrape jobs #370

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any chance to enforce the type in the hash? Also it doesn't need to be optional, if the default is an empty hash.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess it's something like label = { foo: bar, ...}, so how is that expressed in a type?

) 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 = {},
) 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,
}
}
2 changes: 2 additions & 0 deletions manifests/blackbox_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9115,
String[1] $scrape_job_name = 'blackbox',
Optional[Hash] $scrape_job_labels = {},

) inherits prometheus {

Expand Down Expand Up @@ -171,5 +172,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 = {},
) 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 = {},
) 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,
}
}
3 changes: 2 additions & 1 deletion 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,
Optional[Hash] $scrape_job_labels = {},
) {

case $install_method {
Expand Down Expand Up @@ -266,7 +267,7 @@
@@prometheus::scrape_job { "${scrape_host}:${scrape_port}":
job_name => $scrape_job_name,
targets => ["${scrape_host}:${scrape_port}"],
labels => { 'alias' => $scrape_host },
labels => { 'alias' => $scrape_host } + $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 = {},
) 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 = {},
) 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 = {},
) 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 = {},
) 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 = {},
) 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 @@ -123,6 +123,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9104,
String[1] $scrape_job_name = 'mysql',
Optional[Hash] $scrape_job_labels = {},
) inherits prometheus {

#Please provide the download_url for versions < 0.9.0
Expand Down Expand Up @@ -171,5 +172,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 = {},
) 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/node_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 = 9100,
String[1] $scrape_job_name = 'node',
Optional[Hash] $scrape_job_labels = {},
Optional[String[1]] $bin_name = undef,
) inherits prometheus {

Expand Down Expand Up @@ -173,6 +174,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 = {}
) 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 = {},
) 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 = {},
) 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,
}
}
2 changes: 2 additions & 0 deletions manifests/redis_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9121,
String[1] $scrape_job_name = 'redis',
Optional[Hash] $scrape_job_labels = {},
) inherits prometheus {

$release = "v${version}"
Expand Down Expand Up @@ -180,5 +181,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 = {},
) 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 = {},
) 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 = {},
) 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,
}
}