--- {{ ansible_managed | comment }} {{ prometheus__config | to_nice_yaml }} ... {# global: # scrape_interval is set to the global default (60s) # evaluation_interval is set to the global default (60s) # scrape_timeout is set to the global default (10s). # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). external_labels: federated_instance: '{{ inventory_hostname }}' # Alertmanager configuration # Use prometheus alertmanager installed on the same machine alerting: alertmanagers: - static_configs: - targets: ['{{ prometheus_alertmanager }}'] # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: - "alerts/*.yml" # Monitoring alerts, this is the file you may be searching! # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: - job_name: prometheus static_configs: - targets: - localhost:9090 {% if prometheus_servers_targets is defined %} - job_name: servers static_configs: - targets: {{ prometheus_servers_targets | to_json }} relabel_configs: # Do not put :9100 in instance name, rather here - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - source_labels: [__param_target] target_label: __address__ replacement: '$1:9100' {% endif %} {% if prometheus_unifi_snmp_targets is defined %} - job_name: unifi_snmp static_configs: - targets: {{ prometheus_unifi_snmp_targets | to_json }} metrics_path: /snmp params: module: [ubiquiti_unifi] relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 {% endif %} {% if prometheus_ups_snmp_targets is defined %} - job_name: ups_snmp static_configs: - targets: {{ prometheus_ups_snmp_targets | to_json }} metrics_path: /snmp params: module: [eatonups] relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 {% endif %} {% if prometheus_switch_snmp_targets is defined %} - job_name: switch_snmp static_configs: - targets: {{ prometheus_switch_snmp_targets | to_json }} metrics_path: /snmp params: module: [procurve_switch] relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 {% endif %} {% if prometheus_docker_targets is defined %} - job_name: docker static_configs: - targets: {{ prometheus_docker_targets | to_json }} relabel_configs: # Do not put :8087 in instance name, rather here - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - source_labels: [__param_target] target_label: __address__ replacement: '$1:8087' {% endif %} {% if prometheus_postgresql_targets is defined %} - job_name: postgresql static_configs: - targets: {{ prometheus_postgresql_targets | to_json }} relabel_configs: # Do not put :9187 in instance name, rather here - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - source_labels: [__param_target] target_label: __address__ replacement: '$1:9187' {% endif %} {% if prometheus_apc_pdu_snmp_targets is defined %} - job_name: apc_pdu_snmp static_configs: - targets: {{ prometheus_apc_pdu_snmp_targets | to_json }} metrics_path: /snmp params: module: - apc_pdu relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 {% endif %} {% if prometheus_ilo_snmp_targets is defined %} - job_name: ilo_snmp static_configs: - targets: {{ prometheus_ilo_snmp_targets | to_json }} metrics_path: /snmp params: module: - ilo relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 {% endif %} ... #}