Prometheus Apache exporter
							parent
							
								
									27e739741a
								
							
						
					
					
						commit
						562372568b
					
				| 
						 | 
				
			
			@ -9,6 +9,8 @@
 | 
			
		|||
      - targets: [pulsar.adm.crans.org]
 | 
			
		||||
    prometheus_unifi_snmp_targets:
 | 
			
		||||
      - targets: "{{ groups['crans_unifi'] | list | sort }}"
 | 
			
		||||
    prometheus_apache_targets:
 | 
			
		||||
      - targets: [zamok.adm.crans.org]
 | 
			
		||||
  roles:
 | 
			
		||||
    - prometheus
 | 
			
		||||
    - prometheus-alertmanager
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +20,11 @@
 | 
			
		|||
  roles:
 | 
			
		||||
    - prometheus-node
 | 
			
		||||
 | 
			
		||||
# Export apache metrics
 | 
			
		||||
- hosts: zamok.adm.crans.org
 | 
			
		||||
  roles:
 | 
			
		||||
    - prometheus-apache
 | 
			
		||||
 | 
			
		||||
# Deploy grafana
 | 
			
		||||
- hosts: fy.adm.crans.org
 | 
			
		||||
  vars:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
---
 | 
			
		||||
- name: Restart prometheus-apache-exporter
 | 
			
		||||
  service:
 | 
			
		||||
    name: prometheus-apache-exporter
 | 
			
		||||
    state: restarted
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
---
 | 
			
		||||
- name: Install prometheus-apache-exporter
 | 
			
		||||
  apt:
 | 
			
		||||
    update_cache: true
 | 
			
		||||
    name: prometheus-apache-exporter
 | 
			
		||||
  register: apt_result
 | 
			
		||||
  retries: 3
 | 
			
		||||
  until: apt_result is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Make prometheus-apache-exporter listen on adm only
 | 
			
		||||
  lineinfile:
 | 
			
		||||
    path: /etc/default/prometheus-apache-exporter
 | 
			
		||||
    regexp: '^ARGS='
 | 
			
		||||
    line: |
 | 
			
		||||
      ARGS="-telemetry.address={{ ansible_hostname }}.adm.crans.org:9117"
 | 
			
		||||
  notify: Restart prometheus-apache-exporter
 | 
			
		||||
| 
						 | 
				
			
			@ -57,6 +57,12 @@
 | 
			
		|||
    content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}"
 | 
			
		||||
    dest: /etc/prometheus/targets_unifi_snmp.json
 | 
			
		||||
 | 
			
		||||
# We don't need to restart Prometheus when updating nodes
 | 
			
		||||
- name: Configure Prometheus Apache targets
 | 
			
		||||
  copy:
 | 
			
		||||
    content: "{{ prometheus_apache_targets | to_nice_json }}"
 | 
			
		||||
    dest: /etc/prometheus/targets_apache.json
 | 
			
		||||
 | 
			
		||||
- name: Activate prometheus service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: prometheus
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,9 +76,21 @@ scrape_configs:
 | 
			
		|||
      - target_label: __address__
 | 
			
		||||
        replacement: 127.0.0.1:9116
 | 
			
		||||
 | 
			
		||||
  - job_name: apache
 | 
			
		||||
    file_sd_configs:
 | 
			
		||||
      - files:
 | 
			
		||||
        - '/etc/prometheus/targets_apache.json'
 | 
			
		||||
    relabel_configs:
 | 
			
		||||
      # Do not put :9117 in instance name, rather here
 | 
			
		||||
      - source_labels: [__address__]
 | 
			
		||||
        target_label: instance
 | 
			
		||||
      - source_labels: [instance]
 | 
			
		||||
        target_label: __address__
 | 
			
		||||
        replacement: '$1:9117'
 | 
			
		||||
 | 
			
		||||
  - job_name: django
 | 
			
		||||
    scheme: https
 | 
			
		||||
    static_configs:
 | 
			
		||||
#    - targets: []
 | 
			
		||||
    - targets: []
 | 
			
		||||
# Activate this line when the captive portal need monitoring
 | 
			
		||||
    - targets: ["portail-captif.crans.org:443"]
 | 
			
		||||
#    - targets: ["portail-captif.crans.org:443"]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue