Merge "Optionally collect uwsgi stats from unix domain sockets"

This commit is contained in:
Zuul 2018-06-08 02:48:29 +00:00 committed by Gerrit Code Review
commit 73c044ec31
2 changed files with 12 additions and 0 deletions

View File

@ -77,6 +77,13 @@
path: /etc/uwsgi
register: uwsgi
- name: Check for uwsgi stats sockets
find:
paths: /tmp
file_type: any
patterns: '*uwsgi-stats.sock'
register: uwsgi_find_sockets
- name: Set discovery facts
set_fact:
apache_enabled: "{{ (apache2.stat.exists | bool) or (httpd.stat.exists | bool) }}"
@ -88,6 +95,7 @@
nginx_enabled: "{{ nginx.stat.exists | bool }}"
rabbitmq_enabled: "{{ rabbitmq.stat.exists | bool }}"
uwsgi_enabled: "{{ uwsgi.stat.exists | bool }}"
uwsgi_sockets: "{{ uwsgi_find_sockets }}"
# Apache 2 stats enablement
- name: Drop apache2 stats site config

View File

@ -465,7 +465,11 @@ metricbeat.modules:
- module: uwsgi
metricsets: ["status"]
period: 30s
{% if uwsgi_sockets.matched | int > 0 %}
hosts: [{% for file in uwsgi_sockets.files %}"unix://{{ file.path }}"{% if not loop.last %},{% endif %}{% endfor %}]
{% else %}
hosts: ["tcp://127.0.0.1:9191"]
{% endif %}
#
{% endif %}
##------------------------------- vSphere Module ------------------------------