From ecbabfe16555ad41df3779c48149356a2323b59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 29 May 2022 17:25:58 +0200 Subject: [PATCH] change webserver exporting memes --- roles/webserver/files/prometheus-nginx-exporter | 14 ++++++++++++++ roles/webserver/tasks/main.yaml | 8 ++++++++ roles/webserver/templates/nginx.conf | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 roles/webserver/files/prometheus-nginx-exporter diff --git a/roles/webserver/files/prometheus-nginx-exporter b/roles/webserver/files/prometheus-nginx-exporter new file mode 100644 index 0000000..c5f9e91 --- /dev/null +++ b/roles/webserver/files/prometheus-nginx-exporter @@ -0,0 +1,14 @@ +ARGS="-nginx.scrape-uri http://127.0.0.1:8888/stub_status" + +# Prometheus-nginx-exporter supports the following options: +# -nginx.plus +# Start the exporter for NGINX Plus. By default, the exporter is started +# for NGINX. +# -nginx.scrape-uri string +# A URI for scraping NGINX or NGINX Plus metrics. +# For NGINX, the stub_status page must be available through the URI. +# For NGINX Plus -- the API. (default "http://127.0.0.1:8080/stub_status") +# -web.listen-address string +# An address to listen on for web interface and telemetry. (default ":9113") +# -web.telemetry-path string +# A path under which to expose metrics. (default "/metrics" diff --git a/roles/webserver/tasks/main.yaml b/roles/webserver/tasks/main.yaml index 7c9a23c..e07e90a 100644 --- a/roles/webserver/tasks/main.yaml +++ b/roles/webserver/tasks/main.yaml @@ -47,6 +47,14 @@ proto: tcp src: 192.168.69.0/24 +- name: Copy default nginx config + ansible.builtin.copy: + src: prometheus-nginx-exporter + dest: /etc/default/prometheus-nginx-exporter + owner: root + group: root + mode: '0644' + - name: Enable and restart exporter daemon service: name: prometheus-nginx-exporter diff --git a/roles/webserver/templates/nginx.conf b/roles/webserver/templates/nginx.conf index 0ad096d..a37c666 100644 --- a/roles/webserver/templates/nginx.conf +++ b/roles/webserver/templates/nginx.conf @@ -84,7 +84,7 @@ http { {%- endfor %} server { - listen 8080; + listen 8888; location /stub_status { stub_status;