Skip to content

Commit

Permalink
support the new scrape_config_files option, prom ~v2.45
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebigum committed Jul 11, 2024
1 parent 9d545da commit 8d0a4d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ The following parameters are available in the `prometheus` class:
* [`systemd_unit_options`](#-prometheus--systemd_unit_options)
* [`systemd_install_options`](#-prometheus--systemd_install_options)
* [`env_file_path`](#-prometheus--env_file_path)
* [`scrape_config_files`](#-prometheus--scrape_config_files)
* [`manage_config_dir`](#-prometheus--manage_config_dir)
* [`manage_init_file`](#-prometheus--manage_init_file)
* [`manage_config`](#-prometheus--manage_config)
Expand Down Expand Up @@ -913,6 +914,15 @@ Data type: `Stdlib::Absolutepath`



##### <a name="-prometheus--scrape_config_files"></a>`scrape_config_files`

Data type: `Optional[Array]`

Option `scrape_config_files` specifies an Array of file globs. Scrape configs are read from all
matching files and appended to the list of scrape configs.

Default value: `undef`

##### <a name="-prometheus--manage_config_dir"></a>`manage_config_dir`

Data type: `Boolean`
Expand Down Expand Up @@ -11672,6 +11682,7 @@ The following parameters are available in the `prometheus::server` class:
* [`global_config`](#-prometheus--server--global_config)
* [`rule_files`](#-prometheus--server--rule_files)
* [`scrape_configs`](#-prometheus--server--scrape_configs)
* [`scrape_config_files`](#-prometheus--server--scrape_config_files)
* [`include_default_scrape_configs`](#-prometheus--server--include_default_scrape_configs)
* [`remote_read_configs`](#-prometheus--server--remote_read_configs)
* [`remote_write_configs`](#-prometheus--server--remote_write_configs)
Expand Down Expand Up @@ -11876,6 +11887,14 @@ Data type: `Array`

Default value: `$prometheus::scrape_configs`

##### <a name="-prometheus--server--scrape_config_files"></a>`scrape_config_files`

Data type: `Optional[Array]`



Default value: `$prometheus::scrape_config_files`

##### <a name="-prometheus--server--include_default_scrape_configs"></a>`include_default_scrape_configs`

Data type: `Boolean`
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
String $package_name = 'prometheus',
Array $rule_files = [],
Array $scrape_configs = [],
Optional[Array] $scrape_config_files = undef,
Array $remote_read_configs = [],
Array $remote_write_configs = [],
Boolean $enable_tracing = false,
Expand Down
1 change: 1 addition & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Hash $global_config = $prometheus::global_config,
Array $rule_files = $prometheus::rule_files,
Array $scrape_configs = $prometheus::scrape_configs,
Optional[Array] $scrape_config_files = $prometheus::scrape_config_files,
Boolean $include_default_scrape_configs = $prometheus::include_default_scrape_configs,
Array $remote_read_configs = $prometheus::remote_read_configs,
Array $remote_write_configs = $prometheus::remote_write_configs,
Expand Down
4 changes: 4 additions & 0 deletions templates/prometheus.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<% global_config = scope.lookupvar('prometheus::server::global_config') -%>
<% rule_files = scope.lookupvar('prometheus::server::_rule_files') -%>
<% scrape_configs = scope.lookupvar('prometheus::config::scrape_configs') -%>
<% scrape_config_files = scope.lookupvar('prometheus::server::scrape_config_files') -%>
<% remote_read_configs = scope.lookupvar('prometheus::server::remote_read_configs') -%>
<% remote_write_configs = scope.lookupvar('prometheus::server::remote_write_configs') -%>
<% tracing_config = scope.lookupvar('prometheus::server::tracing_config') -%>
Expand All @@ -14,6 +15,9 @@
'alertmanagers'=>scope.lookupvar('prometheus::server::alertmanagers_config'),
},
}
if @scrape_config_files
full_config['scrape_config_files'] = scrape_config_files
end
full_config['remote_read'] = remote_read_configs
full_config['remote_write'] = remote_write_configs
if @enable_tracing
Expand Down

0 comments on commit 8d0a4d5

Please sign in to comment.