Skip to content

Commit

Permalink
feat: prometheus readme
Browse files Browse the repository at this point in the history
  • Loading branch information
janikvonrotz committed Jan 30, 2025
1 parent 1179806 commit 7cc32d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions roles/prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ prometheus_odoo_exporter_basic_auth_username: odoo-exporter
prometheus_odoo_exporter_basic_auth_password: # default: "{{ vault_prometheus_odoo_exporter_basic_auth_password }}"
prometheus_n8n_exporter_basic_auth_username: n8n-exporter
prometheus_n8n_exporter_basic_auth_password: # default: "{{ vault_prometheus_n8n_exporter_basic_auth_password }}"
prometheus_uptime_kuma_exporter_basic_auth_username: uptime-kuma-exporter
prometheus_uptime_kuma_exporter_basic_auth_password: # default: "{{ vault_prometheus_uptime_kuma_exporter_basic_auth_password }}"
prometheus_meilisearch_exporter_api_key: "{{ vault_prometheus_meilisearch_exporter_api_key }}"
prometheus_uptime_kuma_exporter_password: "{{ vault_prometheus_uptime_kuma_exporter_password }}"
```
Ensure the targets nginx proxy includes the exporter config:
Expand Down Expand Up @@ -89,13 +90,15 @@ The `prometheus.yml` template contains predefined srcape jobs that lookup proxy
* **mysqld https**: Targets are `nginx_proxies` with exporter `mysqld`.
* **odoo https**: Targets are `nginx_proxies` with exporter `odoo`.
* **n8n https**: Targets are `nginx_proxies` with exporter `n8n`.
* **uptime-kuma https**: Targets are `nginx_proxies` with exporter `uptime-kuma`.
* **meilisearch https**: Targets are `nginx_proxies` with exporter `meilisearch`.
* **blackbox**: Targets are `nginx_proxies` with `monitor` not false and host is `blackbox01:9115`.

### Custom scrapers

override the variable `prometheus_custom_scrapers`
example:
```
Set the `prometheus_custom_scrapers` variable with you job definition:

```yml
prometheus_custom_scrapers: |
- job_name: n8n business metrics https
metrics_path: "/webhook/metrics"
Expand Down
2 changes: 1 addition & 1 deletion roles/prometheus/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prometheus_mysqld_exporter_basic_auth_password: "{{ vault_prometheus_mysqld_expo
prometheus_odoo_exporter_basic_auth_password: "{{ vault_prometheus_odoo_exporter_basic_auth_password }}"
prometheus_n8n_exporter_proxy_basic_auth_password: "'{{ vault_prometheus_n8n_exporter_proxy_basic_auth_password }}'"
prometheus_meilisearch_exporter_api_key: "{{ vault_prometheus_meilisearch_exporter_api_key }}"
prometheus_uptime_kuma_exporter_password: "{{ vault_prometheus_uptime_kuma_exporter_password }}"
prometheus_uptime_kuma_exporter_basic_auth_password: "{{ vault_prometheus_uptime_kuma_exporter_basic_auth_password }}"
prometheus_alerting: {}
prometheus_rules: {}
prometheus_custom_scrapers: ""
Expand Down
6 changes: 3 additions & 3 deletions roles/prometheus/templates/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ scrape_configs:
static_configs:
- targets: {{ prometheus_hosts | map('extract', hostvars) | json_query('[*].nginx_proxies[?exporter!=null && contains(exporter, `n8n`)].src_hostname') | flatten }}
{% endif %}
{% if prometheus_uptime_kuma_exporter_username is defined %}
{% if prometheus_uptime_kuma_exporter_basic_auth_username is defined %}
- job_name: uptime-kuma https
metrics_path: "/metrics"
scrape_interval: 15s
honor_labels: true
scheme: https
basic_auth:
username: {{ prometheus_uptime_kuma_exporter_username }}
password: {{ prometheus_uptime_kuma_exporter_password }}
username: {{ prometheus_uptime_kuma_exporter_basic_auth_username }}
password: {{ prometheus_uptime_kuma_exporter_basic_auth_password }}
static_configs:
- targets: {{ prometheus_hosts | map('extract', hostvars) | json_query('[*].nginx_proxies[?exporter!=null && contains(exporter, `uptime-kuma`)].src_hostname') | flatten }}
{% endif %}
Expand Down

0 comments on commit 7cc32d6

Please sign in to comment.