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_storage_retention: 3650d
prometheus_install_grafana: false
prometheus_hcloud_enabled: false
prometheus_hcloud_relabel_configs: []
prometheus_install_alertmanager: true

View File

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

View File

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