Unfortunately, blackbox_exporter has only --config.file, not --config.dirs. You could cat together some pieces though, if they have the right indentation.
As for the prometheus config: you can add labels to groups of targets in file_sd, so you can specify the module to use for each target this way. I also like to separate
the instance label and the target IP address, like this:
- job_name: blackbox
file_sd_configs:
- files:
- /etc/prometheus/targets.d/*.yml
metrics_path: /probe
relabel_configs:
# When __address__ consists of just a name or IP address,
# copy it to both the "instance" label (visible to user)
# and "__param_target" (where blackbox_exporter probes)
- source_labels: [__address__]
regex: '([^/]+)'
target_label: instance
- source_labels: [__address__]
regex: '([^/]+)'
target_label: __param_target
# When __address__ is of the form "name/address", extract
# name to "instance" label and address to "__param_target"
- source_labels: [__address__]
regex: '(.+)/(.+)'
target_label: instance
replacement: '${1}'
- source_labels: [__address__]
regex: '(.+)/(.+)'
target_label: __param_target
replacement: '${2}'
# Copy "module" label to "__param_module" so that blackbox_exporter
# receives it as part of the scrape URL
- source_labels: [module]
target_label: __param_module
# Send the actual scrape to SNMP exporter
- target_label: __address__