all prometheus exporter folders get same name prefix

This commit is contained in:
2025-03-03 20:36:06 +01:00
parent 92cb10ba27
commit aac17fece4
31 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
# nginx prometheus exporter
this install a prometheus exporter which it can pool and proxy nginx stub in response.
Nginx needs to be configured with the following location block:
```
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
```
this requires service to scrape using host in url: `http://127.0.0.1/nginx_status` and all other hosts such as public ip or localhost will receive != 20x.

View File

@@ -0,0 +1 @@
---

View File

@@ -0,0 +1,6 @@
---
- name: Restart nginx_prometheus_exporter
systemd:
name: nginx_prometheus_exporter
state: restarted
daemon_reload: yes

View File

@@ -0,0 +1,18 @@
---
- name: Download Nginx Prometheus Exporter
get_url:
url: "https://github.com/nginx/nginx-prometheus-exporter/releases/download/v{{ nginx_exporter_version }}/nginx-prometheus-exporter_{{ nginx_exporter_version }}_linux_amd64.tar.gz"
dest: "/tmp/nginx_prometheus_exporter.tar.gz"
- name: Extract Nginx Prometheus Exporter
unarchive:
src: "/tmp/nginx_prometheus_exporter.tar.gz"
dest: "/tmp"
remote_src: yes
- name: Move Nginx Prometheus Exporter binary
copy:
src: "/tmp/nginx-prometheus-exporter"
dest: "/usr/local/bin/nginx-prometheus-exporter"
remote_src: yes
mode: '0755'

View File

@@ -0,0 +1,3 @@
---
- include_tasks: install.yaml
- include_tasks: service.yml

View File

@@ -0,0 +1,23 @@
---
- name: Create nginx_prometheus_exporter service file
template:
src: "nginx_prometheus_exporter.service.j2"
dest: "/etc/systemd/system/nginx_prometheus_exporter.service"
mode: '0644'
tags:
- create_service
- name: Reload systemd to pick up the nginx_prometheus_exporter service
systemd:
daemon_reload: yes
tags:
- reload_systemd
- name: Enable and start the nginx_prometheus_exporter service
systemd:
name: nginx_prometheus_exporter
state: started
enabled: yes
tags:
- start_nginx_prometheus_exporter

View File

@@ -0,0 +1,11 @@
[Unit]
Description=Nginx Prometheus Exporter
After=network.target
[Service]
User=nobody
ExecStart=/usr/local/bin/nginx-prometheus-exporter -nginx.scrape-uri=http://127.0.0.1/nginx_status
Restart=always
[Install]
WantedBy=multi-user.target