container: add switch for hcloud

This commit is contained in:
uumas
2023-12-21 01:30:00 +02:00
parent 681b788ac4
commit 5bf47c73a7
3 changed files with 11 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ prometheus_scrape_interval: 5s
prometheus_evaluation_interval: 15s prometheus_evaluation_interval: 15s
prometheus_storage_retention: 3650d prometheus_storage_retention: 3650d
prometheus_install_grafana: false prometheus_install_grafana: false
prometheus_hcloud_enabled: false
prometheus_hcloud_relabel_configs: [] prometheus_hcloud_relabel_configs: []
prometheus_install_alertmanager: true prometheus_install_alertmanager: true

View File

@@ -19,10 +19,15 @@ argument_specs:
type: str type: str
required: false required: false
default: 3650d default: 3650d
prometheus_hcloud_token: prometheus_hcloud_enabled:
description: Access token for hetzner cloud service discovery. It will be enabled if this variable is defined description: Whether to use hcloud discovery
type: str type: bool
required: false required: false
default: false
prometheus_hcloud_token:
description: Access token for hetzner cloud service discovery.
type: str
required: "{{ prometheus_hcloud_enabled }}"
prometheus_hcloud_relabel_configs: prometheus_hcloud_relabel_configs:
description: Relabel configs for hcloud description: Relabel configs for hcloud
type: list type: list

View File

@@ -26,11 +26,11 @@ scrape_configs:
static_configs: static_configs:
- targets: ["localhost:9090"] - targets: ["localhost:9090"]
{% if prometheus_hcloud_token is defined %} {% if prometheus_hcloud_enabled %}
- job_name: hcloud - job_name: hcloud
hetzner_sd_configs: hetzner_sd_configs:
- role: hcloud - role: hcloud
authorization: authorization:
credentials: {{ prometheus_hcloud_token }} credentials: {{ prometheus_hcloud_token }}
relabel_configs: {{ prometheus_hcloud_relabel_configs }} relabel_configs: {{ prometheus_hcloud_relabel_configs }}
{% endif %} {%- endif %}