diff --git a/elk_metrics_6x/installMetricbeat.yml b/elk_metrics_6x/installMetricbeat.yml index 67e8f911..e5e2a870 100644 --- a/elk_metrics_6x/installMetricbeat.yml +++ b/elk_metrics_6x/installMetricbeat.yml @@ -89,6 +89,31 @@ rabbitmq_enabled: "{{ rabbitmq.stat.exists | bool }}" uwsgi_enabled: "{{ uwsgi.stat.exists | bool }}" + - name: Drop apache2 stats site config + template: + src: apache-status.conf.j2 + dest: /etc/apache2/sites-available/apache-status.conf + when: apache_enabled + + - name: Enable apache2 stats site + file: + src: /etc/apache2/sites-available/apache-status.conf + dest: /etc/apache2/sites-enabled/apache-status.conf + state: link + when: apache_enabled + + - name: Ensure apache2 stats mode is enabled + apache2_module: + name: status + state: present + when: apache_enabled + + - name: Reload apache2 + service: + name: apache2 + state: reloaded + when: apache_enabled + post_tasks: - name: Drop metricbeat conf file template: diff --git a/elk_metrics_6x/templates/apache-status.conf.j2 b/elk_metrics_6x/templates/apache-status.conf.j2 new file mode 100644 index 00000000..8d7e29bb --- /dev/null +++ b/elk_metrics_6x/templates/apache-status.conf.j2 @@ -0,0 +1,7 @@ +Listen 127.0.1.1:80 + + + + SetHandler server-status + + diff --git a/elk_metrics_6x/templates/metricbeat.yml.j2 b/elk_metrics_6x/templates/metricbeat.yml.j2 index 9a4684e7..9832f1b0 100644 --- a/elk_metrics_6x/templates/metricbeat.yml.j2 +++ b/elk_metrics_6x/templates/metricbeat.yml.j2 @@ -125,7 +125,7 @@ metricbeat.modules: period: 30s # # # Apache hosts - hosts: ["http://127.0.0.1"] + hosts: ["http://{{ ansible_hostname }}"] # # # Path to server status. Default server-status # #server_status_path: "server-status"