feat: optionally push to prometheus and loki

This commit is contained in:
2026-06-02 18:50:20 -03:00
parent fb52a76247
commit aa05d022da
3 changed files with 11 additions and 3 deletions
+6 -2
View File
@@ -6,14 +6,18 @@ DOMAIN=monitoring-ng.example.com
ENABLE_BACKUPS=true
SECRET_BASIC_AUTH_VERSION=v1
# LOKI_PUSH_URL=https://loki.monitoring.example.org/loki/api/v1/push
# Enable this to send logs to a Loki server, adapt DOMAIN if server is
# remote
# LOKI_PUSH_URL=https://loki.$DOMAIN/loki/api/v1/push
# Enable this to send metrics to a Prometheus server, adapt DOMAIN if
# server is remote
# PROMETHEUS_REMOTE_WRITE_URL=https://prometheus.$DOMAIN/api/v1/write
# Monitoring Server
#
## Prometheus
# COMPOSE_FILE="$COMPOSE_FILE:compose.prometheus.yml"
# PROMETHEUS_REMOTE_WRITE_URL=https://prometheus.$DOMAIN/api/v1/write
# PROMETHEUS_RETENTION_TIME=1y
#
## Prometheus Pushgateway
+1 -1
View File
@@ -11,7 +11,7 @@ export PROMETHEUS_YML_VERSION=v2
export MATRIX_ALERTMANAGER_CONFIG_VERSION=e
export MATRIX_ALERTMANAGER_ENTRYPOINT_VERSION=a
export GRAFANA_ALERTS_NODE_VERSION=v1c
export CONFIG_ALLOY_VERSION=v6
export CONFIG_ALLOY_VERSION=v7
# creates a default prometheus scrape config for a given node
add_node(){
+4
View File
@@ -7,6 +7,7 @@ discovery.docker "linux" {
host = "unix:///var/run/docker.sock"
}
{{ if ne (env "PROMETHEUS_REMOTE_WRITE_URL") "" }}
prometheus.exporter.cadvisor "docker" {
}
@@ -38,7 +39,9 @@ prometheus.remote_write "prometheus" {
}
}
}
{{ end }}
{{ if ne (env "LOKI_PUSH_URL") "" }}
loki.source.docker "docker" {
host = "unix:///var/run/docker.sock"
targets = discovery.docker.linux.targets
@@ -56,3 +59,4 @@ loki.write "loki" {
}
}
}
{{ end }}