Files
docker-observation/grafana-alloy/config.alloy
2025-12-29 22:47:11 -06:00

55 lines
1.4 KiB
Plaintext

// https://grafana.com/docs/alloy/latest/monitor/monitor-docker-containers/
prometheus.exporter.cadvisor "docker_metrics" {
docker_host = "unix:///var/run/docker.sock"
storage_duration = "5m"
allowlisted_container_labels = ["name", "container", "container_name", "id"]
}
prometheus.scrape "scraper" {
targets = prometheus.exporter.cadvisor.docker_metrics.targets
forward_to = [ prometheus.remote_write.default.receiver ]
scrape_interval = "10s"
}
prometheus.remote_write "default" {
endpoint {
url = "https://prometheus.john-stream.com:9090/api/v1/write"
tls_config {
cert_file = "/etc/alloy/certs/cert.pem"
key_file = "/etc/alloy/certs/key.pem"
ca_file = "/etc/alloy/certs/root_ca.crt"
}
}
}
discovery.docker "linux" {
host = "unix:///var/run/docker.sock"
}
// discovery.relabel "logs_integrations_docker" {
// targets = []
// rule {
// source_labels = ["__meta_docker_container_name"]
// regex = "/(.*)"
// target_label = "service_name"
// }
// }
// loki.source.docker "default" {
// host = "unix:///var/run/docker.sock"
// targets = discovery.docker.linux.targets
// labels = {"platform" = "docker"}
// relabel_rules = discovery.relabel.logs_integrations_docker.rules
// forward_to = [loki.write.default.receiver]
// }
// loki.write "default" {
// endpoint {
// url = "http://loki:3100/loki/api/v1/push"
// }
// external_labels = {}
// }