if "scrape_configs" not in config_file_yaml:
config_file_yaml["scrape_configs"] = []
+ prometheus_jobs_to_be_added = []
+
for prometheus_job in prometheus_jobs:
cleaned_up_job = clean_up_job(prometheus_job)
- config_file_yaml["scrape_configs"].append(cleaned_up_job)
+ job_to_be_added = True
+ for sc in config_file_yaml["scrape_configs"]:
+ if sc.get("job_name") == cleaned_up_job.get("job_name"):
+ job_to_be_added = False
+ break
+ if job_to_be_added:
+ prometheus_jobs_to_be_added.append(cleaned_up_job)
+
+ for job in prometheus_jobs_to_be_added:
+ config_file_yaml["scrape_configs"].append(job)
return config_file_yaml
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
+ - job_name: 'mon_exporter'
+ static_configs:
+ - targets: ['mon:8000']
- job_name: pushgateway
honor_labels: true
scrape_interval: 30s
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
- scrape_configs: []
- # scrape_configs:
+ scrape_configs:
+ - job_name: 'mon_exporter'
+ static_configs:
+ - targets: ['mon:8000']
# Add here other external targets, e.g. a pushgateway
# - job_name: 'pushgateway'
# static_configs: