diff --git a/files/server-status.conf b/files/server-status.conf new file mode 100644 index 0000000..5ee5b34 --- /dev/null +++ b/files/server-status.conf @@ -0,0 +1,3 @@ + + ServerName localhost + diff --git a/handlers/main.yml b/handlers/main.yml index 6866dc8..9bb3038 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,3 +3,8 @@ service: name: apache2 state: reloaded + +- name: restart munin-node + service: + name: munin-node + state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index 828bc4d..6f3d765 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,3 +1,9 @@ --- - import_tasks: packages.yml + tags: packages + - import_tasks: configuration.yml + tags: configuration + +- import_tasks: monitoring.yml + tags: monitoring diff --git a/tasks/monitoring.yml b/tasks/monitoring.yml new file mode 100644 index 0000000..938aa41 --- /dev/null +++ b/tasks/monitoring.yml @@ -0,0 +1,35 @@ +--- +- name: "monitoring | Aktiviere Apache-Module" + apache2_module: + name: status + state: present + notify: reload apache2 + +- name: "monitoring | Kopiere Konfigurationsdatei" + copy: + src: server-status.conf + dest: /etc/apache2/sites-available/server-status.conf + +- name: "monitoring | Aktiviere Seitenkonfiguration für Localhost" + file: + src: /etc/apache2/sites-available/server-status.conf + dest: /etc/apache2/sites-enabled/server-status.conf + state: link + notify: reload apache2 + +- name: "monitoring | Kopiere Munin-Konfiguration" + template: + src: munin.j2 + dest: /etc/munin/plugin-conf.d/yyy-apache + notify: restart munin-node + +- name: "monitoring | Aktiviere Munin-Plugins" + file: + src: "/usr/share/munin/plugins/{{ item }}" + dest: "/etc/munin/plugins/{{ item }}" + state: link + loop: + - apache_accesses + - apache_processes + - apache_volume + notify: restart munin-node diff --git a/tasks/packages.yml b/tasks/packages.yml index adea42d..bdce678 100644 --- a/tasks/packages.yml +++ b/tasks/packages.yml @@ -3,3 +3,4 @@ apt: pkg: - apache2 + - libwww-perl diff --git a/templates/munin.j2 b/templates/munin.j2 new file mode 100644 index 0000000..4054611 --- /dev/null +++ b/templates/munin.j2 @@ -0,0 +1,6 @@ +[apache*] +env.url http://localhost/server-status?auto +{% if inventory_hostname == "orwell" %} +env.ports 443 +{% endif %} +env.showfree 1