diff --git a/.env.sample b/.env.sample index b68f7c4..ae0fc97 100644 --- a/.env.sample +++ b/.env.sample @@ -88,3 +88,9 @@ SECRET_BASIC_AUTH_VERSION=v1 #ALERT_BACKUP_NOT_SUCCESSFULL_ENABLED=true #ALERT_NODE_DISK_SPACE_ENABLED=true #ALERT_NODE_MEMORY_USAGE_ENABLED=true + +# Garage metrics +# SECRET_GARAGE_METRICS_TOKEN_VERSION=v1 +# GARAGE_METRICS_HOSTNAME= +# GARAGE_INSECURE_SKIP_VERIFY=false +# COMPOSE_FILE="$COMPOSE_FILE:compose.garage.yml" diff --git a/compose.garage.yml b/compose.garage.yml new file mode 100644 index 0000000..092852f --- /dev/null +++ b/compose.garage.yml @@ -0,0 +1,10 @@ +--- +version: "3.8" +services: + app: + secrets: + - garage_token +secrets: + garage_token: + external: true + name: ${STACK_NAME}_garage_token_${SECRET_GARAGE_METRICS_TOKEN_VERSION} diff --git a/config.alloy.tmpl b/config.alloy.tmpl index 2083ce6..cbeed3f 100644 --- a/config.alloy.tmpl +++ b/config.alloy.tmpl @@ -29,6 +29,21 @@ prometheus.scrape "default" { forward_to = [prometheus.remote_write.prometheus.receiver] } +{{ if ne (env "GARAGE_METRICS_HOSTNAME") "" }} +prometheus.scrape "garage" { + bearer_token = "{{ secret "garage_token" }}" + job_name = "garage" + scheme = "https" + + targets = [{ __address__ = "{{ env "GARAGE_METRICS_HOSTNAME" }}:443" }] + forward_to = [prometheus.remote_write.prometheus.receiver] + + tls_config { + insecure_skip_verify = {{ env "GARAGE_INSECURE_SKIP_VERIFY" }} + } +} +{{ end }} + prometheus.remote_write "prometheus" { endpoint { url = "{{ env "PROMETHEUS_REMOTE_WRITE_URL" }}"