3
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-02-28 01:43:10 +00:00

Relocate prometheus-nginxlog-exporter (#4938)

* Use `ansible-role-prometheus-nginxlog-exporter`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Replace `matrix-prometheus-nginxlog-exporter` and `matrix_prometheus_nginxlog_exporter`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Set `matrix-prometheus-nginxlog-exporter` to `prometheus_nginxlog_exporter_identifier`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Set `prometheus_nginxlog_exporter_container_image_*`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Remove `prometheus_nginxlog_exporter_container_image_registry_prefix_upstream`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Move `prometheus_nginxlog_exporter_base_path` to matrix_servers

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Remove unused variables for exposing the service

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Update configuring-playbook-prometheus-grafana.md

About prometheus-nginxlog-exporter

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Rename `prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags_auto`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Set variables

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Remove matrix-prometheus-nginxlog-exporter in favor of ansible-role-prometheus-nginxlog-exporter

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Update CHANGELOG.md

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Update setup.yml: sort entry

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

---------

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>
Co-authored-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>
This commit is contained in:
Suguru Hirahara
2026-02-17 11:40:07 +00:00
committed by GitHub
parent 628bddb613
commit bf744319e0
24 changed files with 87 additions and 3908 deletions

View File

@@ -1,114 +0,0 @@
# SPDX-FileCopyrightText: 2022 MDAD project contributors
# SPDX-FileCopyrightText: 2023 - 2025 Slavi Pantaleev
# SPDX-FileCopyrightText: 2023 Samuel Meenzen
# SPDX-FileCopyrightText: 2024 Suguru Hirahara
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
# prometheus-nginxlog-exporter exports nginx logs in a prometheus usable format on a `/metrics/ endpoint
# See: https://github.com/martin-helmich/prometheus-nginxlog-exporter/
matrix_prometheus_nginxlog_exporter_enabled: true
matrix_prometheus_nginxlog_exporter_identifier: ''
# You don't need to configure a hostname and path prefix if you're not exposing this.
matrix_prometheus_nginxlog_exporter_hostname: ''
matrix_prometheus_nginxlog_exporter_path_prefix: "/metrics/nginxlog"
# renovate: datasource=docker depName=ghcr.io/martin-helmich/prometheus-nginxlog-exporter/exporter
matrix_prometheus_nginxlog_exporter_version: v1.10.0
matrix_prometheus_nginxlog_exporter_container_metrics_port: '4040'
matrix_prometheus_nginxlog_exporter_container_syslog_port: '6514'
matrix_prometheus_nginxlog_exporter_docker_image_arch: ['amd64', 'arm64']
matrix_prometheus_nginxlog_exporter_docker_image: "{{ matrix_prometheus_nginxlog_exporter_docker_image_registry_prefix }}martin-helmich/prometheus-nginxlog-exporter/exporter:{{ matrix_prometheus_nginxlog_exporter_docker_image_tag }}"
matrix_prometheus_nginxlog_exporter_docker_image_registry_prefix: "{{ matrix_prometheus_nginxlog_exporter_docker_image_registry_prefix_upstream }}"
matrix_prometheus_nginxlog_exporter_docker_image_registry_prefix_upstream: "{{ matrix_prometheus_nginxlog_exporter_docker_image_registry_prefix_upstream_default }}"
matrix_prometheus_nginxlog_exporter_docker_image_registry_prefix_upstream_default: "ghcr.io/"
matrix_prometheus_nginxlog_exporter_docker_image_tag: "{{ 'latest' if matrix_prometheus_nginxlog_exporter_version == 'master' else matrix_prometheus_nginxlog_exporter_version }}-{{ matrix_architecture }}"
matrix_prometheus_nginxlog_exporter_docker_image_force_pull: "{{ matrix_prometheus_nginxlog_exporter_docker_image.endswith(':latest') }}"
matrix_prometheus_nginxlog_exporter_docker_image_arch_check_enabled: true
# Controls whether prometheus-nginxlog-exporter metrics should be proxied (exposed) on a public URL
matrix_prometheus_nginxlog_exporter_metrics_proxying_enabled: false
matrix_prometheus_nginxlog_exporter_metrics_proxying_hostname: ''
matrix_prometheus_nginxlog_exporter_metrics_proxying_path_prefix: ''
# matrix_prometheus_nginxlog_exporter_dashboard_urls contains a list of URLs with Grafana dashboard definitions.
# If the Grafana role is enabled, these dashboards will be downloaded.
matrix_prometheus_nginxlog_exporter_dashboard_urls: []
matrix_prometheus_nginxlog_exporter_base_path: "{{ matrix_base_data_path }}/prometheus-nginxlog-exporter"
matrix_prometheus_nginxlog_exporter_config_path: "{{ matrix_prometheus_nginxlog_exporter_base_path }}/config"
matrix_prometheus_nginxlog_exporter_container_network: "{{ matrix_prometheus_nginxlog_exporter_identifier }}"
matrix_prometheus_nginxlog_exporter_container_additional_networks: "{{ matrix_prometheus_nginxlog_exporter_container_additional_networks_auto + matrix_prometheus_nginxlog_exporter_container_additional_networks_custom }}"
matrix_prometheus_nginxlog_exporter_container_additional_networks_auto: []
matrix_prometheus_nginxlog_exporter_container_additional_networks_custom: []
# matrix_prometheus_nginxlog_exporter_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container.
# See `../templates/labels.j2` for details.
#
# To inject your own other container labels, see `matrix_prometheus_nginxlog_exporter_container_labels_additional_labels`.
matrix_prometheus_nginxlog_exporter_container_labels_traefik_enabled: "{{ true if matrix_prometheus_nginxlog_exporter_hostname else false }}"
matrix_prometheus_nginxlog_exporter_container_labels_traefik_docker_network: "{{ matrix_prometheus_nginxlog_exporter_container_network }}"
matrix_prometheus_nginxlog_exporter_container_labels_traefik_hostname: "{{ matrix_prometheus_nginxlog_exporter_hostname }}"
# The path prefix must either be `/` or not end with a slash (e.g. `/metrics`).
matrix_prometheus_nginxlog_exporter_container_labels_traefik_path_prefix: "{{ matrix_prometheus_nginxlog_exporter_path_prefix }}"
matrix_prometheus_nginxlog_exporter_container_labels_traefik_rule: "Host(`{{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_hostname }}`) && PathPrefix(`{{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_path_prefix }}`)"
matrix_prometheus_nginxlog_exporter_container_labels_traefik_entrypoints: web-secure
matrix_prometheus_nginxlog_exporter_container_labels_traefik_tls: "{{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_entrypoints != 'web' }}"
matrix_prometheus_nginxlog_exporter_container_labels_traefik_tls_certResolver: default # noqa var-naming
matrix_prometheus_nginxlog_exporter_container_labels_metrics_middleware_basic_auth_enabled: false
# See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users
matrix_prometheus_nginxlog_exporter_container_labels_metrics_middleware_basic_auth_users: ''
# matrix_prometheus_nginxlog_exporter_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
# See `../templates/labels.j2` for details.
#
# Example:
# matrix_prometheus_nginxlog_exporter_container_labels_additional_labels: |
# my.label=1
# another.label="here"
matrix_prometheus_nginxlog_exporter_container_labels_additional_labels: ''
# A list of extra docker arguments to pass to the container
matrix_prometheus_nginxlog_exporter_container_extra_arguments: []
# List of systemd services that matrix-prometheus_nginxlog_exporter.service depends on
matrix_prometheus_nginxlog_exporter_systemd_required_services_list: "{{ matrix_prometheus_nginxlog_exporter_systemd_required_services_list_default + matrix_prometheus_nginxlog_exporter_systemd_required_services_list_auto + matrix_prometheus_nginxlog_exporter_systemd_required_services_list_custom }}"
matrix_prometheus_nginxlog_exporter_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
matrix_prometheus_nginxlog_exporter_systemd_required_services_list_auto: []
matrix_prometheus_nginxlog_exporter_systemd_required_services_list_custom: []
# List of systemd services that matrix-prometheus_nginxlog_exporter.service wants
matrix_prometheus_nginxlog_exporter_systemd_wanted_services_list: []
# Controls whether the matrix-prometheus_nginxlog_exporter container exposes its HTTP port (tcp/4040 in the container).
#
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:4040"), or empty string to not expose.
matrix_prometheus_nginxlog_exporter_container_http_host_bind_port: ''
# Controls whether the matrix-prometheus_nginxlog_exporter container exposes its SYSLOG port (udp/6514 in the container).
#
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:6514"), or empty string to not expose.
# Note: is an UDP connection!
matrix_prometheus_nginxlog_exporter_container_syslog_host_bind_port: ''
matrix_prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags: "{{ matrix_prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags_auto + matrix_prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags_custom }}"
matrix_prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags_auto: []
matrix_prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags_custom: []
# matrix_prometheus_nginxlog_exporter_restart_necessary controls whether the service
# will be restarted (when true) or merely started (when false) by the
# systemd service manager role (when conditional restart is enabled).
#
# This value is automatically computed during installation based on whether
# any configuration files, the systemd service file, or the container image changed.
# The default of `false` means "no restart needed" — appropriate when the role's
# installation tasks haven't run (e.g., due to --tags skipping them).
matrix_prometheus_nginxlog_exporter_restart_necessary: false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

View File

@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2022 MDAD project contributors
SPDX-License-Identifier: AGPL-3.0-or-later

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

View File

@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2022 MDAD project contributors
SPDX-License-Identifier: AGPL-3.0-or-later

View File

@@ -1,25 +0,0 @@
# SPDX-FileCopyrightText: 2022 MDAD project contributors
# SPDX-FileCopyrightText: 2023 - 2024 Slavi Pantaleev
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- tags:
- setup-all
- setup-prometheus-nginxlog-exporter
- install-all
- install-prometheus-nginxlog-exporter
block:
- when: matrix_prometheus_nginxlog_exporter_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
- when: matrix_prometheus_nginxlog_exporter_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
- tags:
- setup-all
- setup-prometheus-nginxlog-exporter
block:
- when: not matrix_prometheus_nginxlog_exporter_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"

View File

@@ -1,73 +0,0 @@
# SPDX-FileCopyrightText: 2022 MDAD project contributors
# SPDX-FileCopyrightText: 2023 - 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2024 David Mehren
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Ensure matrix-prometheus-nginxlog-exporter image is pulled
community.docker.docker_image:
name: "{{ matrix_prometheus_nginxlog_exporter_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
force_source: "{{ matrix_prometheus_nginxlog_exporter_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_prometheus_nginxlog_exporter_docker_image_force_pull }}"
register: matrix_prometheus_nginxlog_exporter_container_image_pull_result
retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}"
until: matrix_prometheus_nginxlog_exporter_container_image_pull_result is not failed
- name: Ensure prometheus-nginxlog-exporter paths exists
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0750'
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
with_items:
- "{{ matrix_prometheus_nginxlog_exporter_base_path }}"
- "{{ matrix_prometheus_nginxlog_exporter_config_path }}"
- name: Ensure prometheus-nginxlog-exporter.yaml present
ansible.builtin.template:
src: "{{ role_path }}/templates/prometheus-nginxlog-exporter.yaml.j2"
dest: "{{ matrix_prometheus_nginxlog_exporter_config_path }}/prometheus-nginxlog-exporter.yaml"
mode: '0644'
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
register: matrix_prometheus_nginxlog_exporter_config_result
- name: Ensure prometheus-nginxlog-exporter support files installed
ansible.builtin.template:
src: "{{ role_path }}/templates/{{ item }}.j2"
dest: "{{ matrix_prometheus_nginxlog_exporter_base_path }}/{{ item }}"
mode: '0640'
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
with_items:
- labels
register: matrix_prometheus_nginxlog_exporter_support_files_result
- name: Ensure prometheus-nginxlog-exporter container network is created
community.general.docker_network:
enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
name: "{{ matrix_prometheus_nginxlog_exporter_container_network }}"
driver: bridge
driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
- name: Ensure matrix-prometheus-nginxlog-exporter.service installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-prometheus-nginxlog-exporter.service.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-prometheus-nginxlog-exporter.service"
mode: '0644'
register: matrix_prometheus_nginxlog_exporter_systemd_service_result
- name: Determine whether matrix-prometheus-nginxlog-exporter needs a restart
ansible.builtin.set_fact:
matrix_prometheus_nginxlog_exporter_restart_necessary: >-
{{
matrix_prometheus_nginxlog_exporter_config_result.changed | default(false)
or matrix_prometheus_nginxlog_exporter_support_files_result.changed | default(false)
or matrix_prometheus_nginxlog_exporter_systemd_service_result.changed | default(false)
or matrix_prometheus_nginxlog_exporter_container_image_pull_result.changed | default(false)
}}

View File

@@ -1,30 +0,0 @@
# SPDX-FileCopyrightText: 2022 MDAD project contributors
# SPDX-FileCopyrightText: 2023 - 2024 Slavi Pantaleev
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Check existence of matrix-prometheus-nginxlog-exporter service
ansible.builtin.stat:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-prometheus-nginxlog-exporter.service"
register: matrix_prometheus_nginxlog_exporter_service_stat
- when: matrix_prometheus_nginxlog_exporter_service_stat.stat.exists | bool
block:
- name: Ensure matrix-prometheus-nginxlog-exporter is stopped
ansible.builtin.service:
name: matrix-prometheus-nginxlog-exporter
state: stopped
enabled: false
daemon_reload: true
- name: Ensure matrix-prometheus-nginxlog-exporter.service doesn't exist
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-prometheus-nginxlog-exporter.service"
state: absent
- name: Ensure matrix-prometheus-nginxlog-exporter path doesn't exist
ansible.builtin.file:
path: "{{ matrix_prometheus_nginxlog_exporter_base_path }}"
state: absent

View File

@@ -1,44 +0,0 @@
# SPDX-FileCopyrightText: 2022 MDAD project contributors
# SPDX-FileCopyrightText: 2023 - 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2025 Suguru Hirahara
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: (Deprecation) Catch and report renamed prometheus-nginxlog-exporter settings
ansible.builtin.fail:
msg: >-
Your configuration contains a variable, which now has a different name.
Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml).
when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
with_items:
- {'old': 'matrix_prometheus_nginxlog_exporter_container_hostname', 'new': 'matrix_prometheus_nginxlog_exporter_identifier'}
- {'old': 'matrix_prometheus_nginxlog_exporter_docker_image_name_prefix', 'new': 'matrix_prometheus_nginxlog_exporter_docker_image_registry_prefix'}
- name: Fail if docker image not available for arch
ansible.builtin.fail:
msg: >
'prometheus-nginxlog-exporter' docker image is not available for your arch '{{ matrix_architecture }}'.
We currently do not support building an image using this playbook.
You can use a custom-build image by setting
'matrix_prometheus_nginxlog_exporter_docker_image_arch_check_enabled: false'
'matrix_prometheus_nginxlog_exporter_docker_image: path/to/docker/image:tag'
or disable 'prometheus-nginxlog-exporter' by setting
'matrix_prometheus_nginxlog_exporter: false'
in vars.yml
when: matrix_prometheus_nginxlog_exporter_docker_image_arch_check_enabled and matrix_architecture not in matrix_prometheus_nginxlog_exporter_docker_image_arch
- name: Fail if required prometheus-nginxlog-exporter settings not defined
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item.name }}`).
when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0"
with_items:
- {'name': 'matrix_prometheus_nginxlog_exporter_metrics_proxying_hostname', when: "{{ matrix_prometheus_nginxlog_exporter_metrics_proxying_enabled }}"}
- {'name': 'matrix_prometheus_nginxlog_exporter_metrics_proxying_path_prefix', when: "{{ matrix_prometheus_nginxlog_exporter_metrics_proxying_enabled }}"}
- {'name': 'matrix_prometheus_nginxlog_exporter_container_network', when: true}

View File

@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2023 Slavi Pantaleev
SPDX-License-Identifier: AGPL-3.0-or-later

View File

@@ -1,42 +0,0 @@
{#
SPDX-FileCopyrightText: 2024 Slavi Pantaleev
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{% if matrix_prometheus_nginxlog_exporter_container_labels_traefik_enabled %}
traefik.enable=true
{% if matrix_prometheus_nginxlog_exporter_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_docker_network }}
{% endif %}
traefik.http.services.{{ matrix_prometheus_nginxlog_exporter_identifier }}.loadbalancer.server.port={{ matrix_prometheus_nginxlog_exporter_container_metrics_port }}
{% set middlewares = [] %}
{% if matrix_prometheus_nginxlog_exporter_container_labels_metrics_middleware_basic_auth_enabled %}
{% set middlewares = middlewares + [matrix_prometheus_nginxlog_exporter_identifier + '-basic-auth'] %}
traefik.http.middlewares.{{ matrix_prometheus_nginxlog_exporter_identifier }}-basic-auth.basicauth.users={{ matrix_prometheus_nginxlog_exporter_container_labels_metrics_middleware_basic_auth_users }}
{% endif %}
{% set middlewares = middlewares + [matrix_prometheus_nginxlog_exporter_identifier + '-replacepath'] %}
traefik.http.middlewares.{{ matrix_prometheus_nginxlog_exporter_identifier }}-replacepath.replacepath.path=/metrics
traefik.http.routers.{{ matrix_prometheus_nginxlog_exporter_identifier }}.rule={{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_rule }}
{% if middlewares | length > 0 %}
traefik.http.routers.{{ matrix_prometheus_nginxlog_exporter_identifier }}.middlewares={{ middlewares | join(',') }}
{% endif %}
traefik.http.routers.{{ matrix_prometheus_nginxlog_exporter_identifier }}.service={{ matrix_prometheus_nginxlog_exporter_identifier }}
traefik.http.routers.{{ matrix_prometheus_nginxlog_exporter_identifier }}.entrypoints={{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_entrypoints }}
traefik.http.routers.{{ matrix_prometheus_nginxlog_exporter_identifier }}.tls={{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_tls | to_json }}
{% if matrix_prometheus_nginxlog_exporter_container_labels_traefik_tls %}
traefik.http.routers.{{ matrix_prometheus_nginxlog_exporter_identifier }}.tls.certResolver={{ matrix_prometheus_nginxlog_exporter_container_labels_traefik_tls_certResolver }}
{% endif %}
{% endif %}
{{ matrix_prometheus_nginxlog_exporter_container_labels_additional_labels }}

View File

@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2022 MDAD project contributors
SPDX-License-Identifier: AGPL-3.0-or-later

View File

@@ -1,64 +0,0 @@
{#
SPDX-FileCopyrightText: 2022 MDAD project contributors
SPDX-FileCopyrightText: 2024 Slavi Pantaleev
SPDX-License-Identifier: AGPL-3.0-or-later
#}
listen:
port: {{ matrix_prometheus_nginxlog_exporter_container_metrics_port }}
address: "0.0.0.0"
metrics_endpoint: "/metrics"
namespaces:
- name: matrix
metrics_override:
prefix: "myprefix"
namespace_label: "namespace"
format: "$log_source $server_name - $upstream_addr - $remote_addr - $remote_user [$time_local] $host \"$request\" $status \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\""
# enable to print to console
# print_log: true
source:
syslog:
listen_address: "udp://0.0.0.0:{{ matrix_prometheus_nginxlog_exporter_container_syslog_port }}"
# format options: "rfc3164" ,"rfc5424", "rfc6587", "auto"
format: auto
tags: {{ matrix_prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags | to_json }}
relabel_configs:
- target_label: request_uri
from: request
split: 2
separator: ' '
matches:
- regexp: "^([^\\?]+)/(public|bundles|fonts|img|themes|vector-icons|element-icons|d|media).*"
replacement: "$1/$2/"
- regexp: "^([^\\?]+).*/rooms/.*/(event|read_markers|messages|receipt|state|typing|members).*"
replacement: "$1/rooms/:roomid:/$2"
- regexp: "^([^\\?]+).*/(r0|v3)/(sync|pushers|keys|devices|download|sendtodevice).*"
replacement: "$1/:v:/$3"
- regexp: "^([^\\?]+).*/rooms/(.*)/send/(.*)"
replacement: "$1/rooms/:roomid:/send/:command:/:id:"
- regexp: "^([^\\?]+).*/client/unstable/.*"
replacement: "$1/client/unstable/:matrixspec:"
- regexp: "^([^\\?]+).*/presence/.*"
replacement: "$1/presence/:userid:"
- regexp: "^([^\\?]+).*/user/.*"
replacement: "$1/user/:userid:"
- regexp: "^([^\\?]+).*/profile/.*"
replacement: "$1/profile/:userid:"
- regexp: "^([^\\?]+).*/directory/room/.*"
replacement: "$1/directory/room/:roomid:"
- regexp: "^([^\\?]+).*/thumbnail/.*"
replacement: "$1/thumbnail/:domain:/:mxid:"
- regexp: "^([^\\?]+)(.*)"
replacement: "$1"
- target_label: remote_addr
from: remote_addr
- target_label: server_name
from: server_name
- target_label: http_x_forwarded_for
from: http_x_forwarded_for
- target_label: request_host
from: host
- target_label: log_source
from: log_source

View File

@@ -1,54 +0,0 @@
#jinja2: lstrip_blocks: True
[Unit]
Description=prometheus-nginxlog-exporteer ({{ matrix_prometheus_nginxlog_exporter_identifier }})
{% for service in matrix_prometheus_nginxlog_exporter_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
{% for service in matrix_prometheus_nginxlog_exporter_systemd_wanted_services_list %}
Wants={{ service }}
{% endfor %}
DefaultDependencies=no
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} {{ matrix_prometheus_nginxlog_exporter_identifier }} 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ matrix_prometheus_nginxlog_exporter_identifier }} 2>/dev/null || true'
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name={{ matrix_prometheus_nginxlog_exporter_identifier }} \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--read-only \
--network={{ matrix_prometheus_nginxlog_exporter_container_network }} \
{% if matrix_prometheus_nginxlog_exporter_container_http_host_bind_port %}
-p {{ matrix_prometheus_nginxlog_exporter_container_http_host_bind_port }}:{{ matrix_prometheus_nginxlog_exporter_container_metrics_port }} \
{% endif %}
{% if matrix_prometheus_nginxlog_exporter_container_syslog_host_bind_port %}
-p {{ matrix_prometheus_nginxlog_exporter_container_syslog_host_bind_port }}:{{ matrix_prometheus_nginxlog_exporter_container_syslog_port }}/udp \
{% endif %}
--mount type=bind,src={{ matrix_prometheus_nginxlog_exporter_config_path }},dst=/etc/prometheus-nginxlog-exporter \
--label-file={{ matrix_prometheus_nginxlog_exporter_base_path }}/labels \
{% for arg in matrix_prometheus_nginxlog_exporter_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ matrix_prometheus_nginxlog_exporter_docker_image }} \
-config-file /etc/prometheus-nginxlog-exporter/prometheus-nginxlog-exporter.yaml
{% for network in matrix_prometheus_nginxlog_exporter_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ matrix_prometheus_nginxlog_exporter_identifier }}
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ matrix_prometheus_nginxlog_exporter_identifier }}
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} {{ matrix_prometheus_nginxlog_exporter_identifier }} 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ matrix_prometheus_nginxlog_exporter_identifier }} 2>/dev/null || true'
Restart=always
RestartSec=30
SyslogIdentifier={{ matrix_prometheus_nginxlog_exporter_identifier }}
[Install]
WantedBy=multi-user.target

View File

@@ -1,4 +0,0 @@
SPDX-FileCopyrightText: 2022 MDAD project contributors
SPDX-FileCopyrightText: 2023 - 2025 Slavi Pantaleev
SPDX-License-Identifier: AGPL-3.0-or-later

View File

@@ -4,6 +4,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
---
# Controls if (`matrix_prometheus_nginxlog_exporter` -> `prometheus_nginxlog_exporter`) validation will run.
matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_validation_enabled: true
# Controls if (`matrix_prometheus_node_exporter` -> `prometheus_node_exporter`) validation will run.
matrix_playbook_migration_matrix_prometheus_node_exporter_migration_validation_enabled: true

View File

@@ -95,6 +95,16 @@
- {'old': 'hydrogen_docker_image_registry_prefix_upstream', 'new': 'hydrogen_container_image_registry_prefix_upstream'}
- {'old': 'hydrogen_docker_image_registry_prefix_upstream_default', 'new': 'hydrogen_container_image_registry_prefix_upstream_default'}
- {'old': 'prometheus_nginxlog_exporter_docker_image', 'new': 'prometheus_nginxlog_exporter_container_image'}
- {'old': 'prometheus_nginxlog_exporter_docker_image_registry_prefix', 'new': 'prometheus_nginxlog_exporter_container_image_registry_prefix'}
- {'old': 'prometheus_nginxlog_exporter_docker_image_registry_prefix_upstream', 'new': 'prometheus_nginxlog_exporter_container_image_registry_prefix_upstream'}
- {'old': 'prometheus_nginxlog_exporter_docker_image_registry_prefix_upstream_default', 'new': 'prometheus_nginxlog_exporter_container_image_registry_prefix_upstream_default'}
- {'old': 'prometheus_nginxlog_exporter_docker_image_arch_check_enabled', 'new': 'prometheus_nginxlog_exporter_container_image_arch_check_enabled'}
- {'old': 'prometheus_nginxlog_exporter_metrics_proxying_enabled', 'new': 'prometheus_nginxlog_exporter_container_labels_traefik_enabled'}
- {'old': 'prometheus_nginxlog_exporter_metrics_proxying_hostname', 'new': 'prometheus_nginxlog_exporter_container_labels_traefik_hostname'}
- {'old': 'prometheus_nginxlog_exporter_metrics_proxying_path_prefix', 'new': 'prometheus_nginxlog_exporter_container_labels_traefik_path_prefix'}
- {'old': 'prometheus_nginxlog_exporter_config_namespaces_matrix_source_tags_custom', 'new': 'prometheus_nginxlog_exporter_config_namespaces_source_tags_custom'}
- name: (Deprecation) Catch and report matrix_postgres variables
ansible.builtin.fail:
msg: |-
@@ -124,6 +134,25 @@
The following variables in your configuration need to be renamed: {{ lookup('ansible.builtin.varnames', '^matrix_mailer_.+', wantlist=True) | join(', ') }}
when: "lookup('ansible.builtin.varnames', '^matrix_mailer_.+', wantlist=True) | length > 0"
- when: matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_validation_enabled | bool
block:
- ansible.builtin.set_fact:
matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_vars: |-
{{ lookup('ansible.builtin.varnames', '^matrix_prometheus_nginxlog_exporter_.+', wantlist=True) }}
- name: (Deprecation) Catch and report matrix_prometheus_nginxlog_exporter variables
ansible.builtin.fail:
msg: >-
The matrix-prometheus-nginxlog-exporter role that used to be part of this playbook has been replaced by https://github.com/mother-of-all-self-hosting/ansible-role-prometheus-nginxlog-exporter.
The new role is compatible with the old one, but uses different names for its variables.
Please rename all variables (`matrix_prometheus_nginxlog_exporter_` -> `prometheus_nginxlog_exporter_`) on your configuration file (vars.yml).
After renaming them, please do not forget to fetch the Ansible role. See docs/maintenance-upgrading-services.md for details about how to do so.
The following variables in your configuration need to be renamed: {{ matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_vars | join(', ') }}
when: "matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_vars | length > 0"
- when: matrix_playbook_migration_matrix_prometheus_node_exporter_migration_validation_enabled | bool
block:
- ansible.builtin.set_fact: