From 232bdca2add4253981b0873188663069f74a0610 Mon Sep 17 00:00:00 2001 From: Colin Wilk Date: Sun, 11 Jun 2023 18:53:04 +0200 Subject: Add ability to specify target path prefix This will decrease the amount of redundant configuration for users by allowing them to specify a general prefix on global / exporter / play level Signed-off-by: Colin Wilk --- defaults/main.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'defaults/main.yml') diff --git a/defaults/main.yml b/defaults/main.yml index 52afffd..0a8e9ba 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -91,6 +91,16 @@ prometheus_target_strategy_lineinfile_suffix: '' # Exporter configuration ################################################################################ +# You can configure a target prefix to keep your targets in your exporters +# configuration. DRY For example if all your target files reside in +# /opt/prometheus it's a good idea to set the prefix to /opt/prometheus/ so that +# you can define your remaining target files as just target.yml instead of +# /opt/prometheus/target.yml +# In case you have a few exporters that reside in different directories you may +# ignore the prefix by specifying `path_prefix: ''` in the exporter default +# or the enabled exporter config. +prometheus_target_exporter_target_prefix: '' + # This will configure the default settings for specified exporters. # The key in this dict should map to the possible id in the specified exporter # in prometheus_target_exporter or prometheus_target_default_exporters. @@ -105,8 +115,9 @@ prometheus_target_exporter_defaults: {} # path: /opt/prometheus/targets.yml # host: '{{ inventory_hostname }}:9100' # blackbox_exporter: - # path: /opt/prometheus/blackbox.yml + # path: /opt/targets/blackbox.yml # host: 'https://{{ hostvars[inventory_hostname].ansible_host }}' + # path_prefix: '' # This is where you specify the exporters that should be deployed to prometheus. # You should configure this on a per play basis. If you wish to configure @@ -125,7 +136,7 @@ prometheus_target_exporter: [] # ignored. prometheus_target_default_exporters: [] # - { id: node_exporter } - # - { id: blackbox_exporter, path: /path/to/target } + # - { id: blackbox_exporter, path: /path/to/target, path_prefix: '' } # You can enable this variable to not add exporters defined in # prometheus_target_default_exporters -- cgit v1.2.3