From 3e2aefd6affde1d740b7de893cea87c7f493c2b3 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Wed, 15 Feb 2017 15:13:56 +0100 Subject: [PATCH] ansible-roles/netdata#8 Configure weblog monitoring --- tasks/apache.yml | 8 ++++++++ tasks/configure.yml | 1 + templates/python.d.conf | 18 ++++++++++++++++- templates/web_log.conf | 43 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 templates/web_log.conf diff --git a/tasks/apache.yml b/tasks/apache.yml index df0e606..6e20d00 100644 --- a/tasks/apache.yml +++ b/tasks/apache.yml @@ -19,3 +19,11 @@ - name: "Enable Apache Status Site" command: a2ensite status creates=/etc/apache2/sites-enabled/status{{ apache_conf_ext|default('.conf') }} notify: "Restart Apache" + +- name: "Weblog Module Configuration" + template: + src: 'web_log.conf' + dest: '/etc/netdata/python.d/web_log.conf' + owner: 'netdata' + group: 'netdata' + mode: '660' diff --git a/tasks/configure.yml b/tasks/configure.yml index a482faf..6e92575 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -32,6 +32,7 @@ backup: yes with_items: - 'health_alarm_notify.conf' + - 'python.d.conf' notify: - "Restart NetData" diff --git a/templates/python.d.conf b/templates/python.d.conf index b6520e6..03ee69c 100644 --- a/templates/python.d.conf +++ b/templates/python.d.conf @@ -23,20 +23,36 @@ log_interval: 3600 # Setting any of these to no will disable it. apache: {{ (groups['webserver'] is defined and inventory_hostname in groups['webserver'])|ternary("yes", "no") }} -apache_cache: {{ (groups['webserver'] is defined and inventory_hostname in groups['webserver'])|ternary("yes", "no") }} +apache_cache: no +bind_rndc: yes cpufreq: yes +cpuidle: yes dovecot: no +elasticsearch: {{ (groups['logserver'] is defined and inventory_hostname in groups['logserver'])|ternary("yes", "no") }} example: no exim: no +fail2ban: yes +freeradius: yes +gunicorn_log: no +haproxy: {{ (groups['proxyserver'] is defined and inventory_hostname in groups['proxyserver'])|ternary("yes", "no") }} hddtemp: yes ipfs: no +isc_dhcpd: yes +mdstat: yes memcached: {{ (groups['webserver'] is defined and inventory_hostname in groups['webserver'])|ternary("yes", "no") }} mysql: {{ (groups['dbserver-mysql'] is defined and inventory_hostname in groups['dbserver-mysql'])|ternary("yes", "no") }} nginx: no nginx_log: no +nginx_log: no +ovpn_status_log: yes phpfpm: {{ (groups['webserver'] is defined and inventory_hostname in groups['webserver'])|ternary("yes", "no") }} postfix: yes +postgres: yes redis: {{ (groups['webserver'] is defined and inventory_hostname in groups['webserver'])|ternary("yes", "no") }} +retroshare: yes sensors: yes +smartd_log: yes squid: no tomcat: no +varnish: {{ (groups['varnishserver'] is defined and inventory_hostname in groups['varnishserver'])|ternary("yes", "no") }} +web_log: {{ (groups['webserver'] is defined and inventory_hostname in groups['webserver'])|ternary("yes", "no") }} diff --git a/templates/web_log.conf b/templates/web_log.conf new file mode 100644 index 0000000..b73c2d5 --- /dev/null +++ b/templates/web_log.conf @@ -0,0 +1,43 @@ +apache_log: + name: 'apache' + path: '/var/log/apache2/access.log' + +apache_ssl_log: + name: 'apache_ssl' + path: '/var/log/apache2/ssl_access.log' + +apache_vhosts_log: + name: 'apache_vhosts' + path: '/var/log/apache2/other_vhosts_access.log' +{% for drupal in drupal_settings|default([]) %} +{% for drupal_domain in drupal.domains|default([]) %} + +apache_log_{{ drupal_domain.domain|regex_replace('[\.\-]', '_') }}: + name: 'apache_{{ drupal_domain.domain|regex_replace('[\.\-]', '_') }}' + path: '{% if drupal.jail is defined %}{{ jailroot|default('/jails') }}/{{ drupal.jail.name }}{% endif %}/var/log/apache2/{{ drupal_domain.domain }}-access.log' +{% endfor %} +{% endfor %} +{% for nextcloud in nextcloud_settings|default([]) %} + +apache_log_{{ nextcloud.domain|regex_replace('[\.\-]', '_') }}: + name: 'apache_{{ nextcloud.domain|regex_replace('[\.\-]', '_') }}' + path: '{% if nextcloud.jail is defined %}{{ jailroot|default('/jails') }}/{{ nextcloud.jail.name }}{% endif %}/var/log/apache2/{{ nextcloud.domain }}-access.log' +{% endfor %} +{% for piwik in piwik_settings|default([]) %} + +apache_log_{{ piwik.domain|regex_replace('[\.\-]', '_') }}: + name: 'apache_{{ piwik.domain|regex_replace('[\.\-]', '_') }}' + path: '{% if piwik.jail is defined %}{{ jailroot|default('/jails') }}/{{ piwik.jail.name }}{% endif %}/var/log/apache2/{{ piwik.domain }}-access.log' +{% endfor %} +{% for youtrack in youtrack_settings|default([]) %} + +apache_log_{{ youtrack.domain|regex_replace('[\.\-]', '_') }}: + name: 'apache_{{ youtrack.domain|regex_replace('[\.\-]', '_') }}' + path: '{% if youtrack.jail is defined %}{{ jailroot|default('/jails') }}/{{ youtrack.jail.name }}{% endif %}/var/log/apache2/{{ youtrack.domain }}-access.log' +{% endfor %} +{% for log in apache_logs|default([]) %} + +apache_log_{{ log.name }}: + name: 'apache_{{ log.name }}' + path: '{{ log.file }}' +{% endfor %} -- GitLab