Created
October 15, 2024 08:04
-
-
Save theplatypus/48c14595242769cd38e7cb297ef1a437 to your computer and use it in GitHub Desktop.
Alloy basic config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prometheus.exporter.unix "node" { | |
set_collectors = [ | |
"uname", | |
"cpu", | |
"cpufreq", | |
"loadavg", | |
"meminfo", | |
"filesystem", | |
"netdev", | |
] | |
} | |
prometheus.scrape "node" { | |
scrape_interval = "60s" | |
scrape_timeout = "4s" | |
targets = prometheus.exporter.unix.node.targets | |
forward_to = [prometheus.remote_write.cockpit.receiver] | |
} | |
prometheus.remote_write "cockpit" { | |
endpoint { | |
url = "<PROM_URL>/api/v1/push" | |
headers = { | |
"X-TOKEN" = "<PROM_TOKEN>", | |
} | |
} | |
} | |
discovery.docker "containers" { | |
host = "unix:///var/run/docker.sock" | |
} | |
discovery.relabel "logs_integrations_docker" { | |
targets = [] | |
rule { | |
target_label = "job" | |
replacement = "integrations/docker" | |
} | |
rule { | |
target_label = "instance" | |
replacement = constants.hostname | |
} | |
rule { | |
source_labels = ["__meta_docker_container_name"] | |
regex = "/(.*)" | |
target_label = "container" | |
} | |
} | |
loki.source.docker "default" { | |
host = "unix:///var/run/docker.sock" | |
targets = discovery.docker.containers.targets | |
labels = {"app" = "docker"} | |
relabel_rules = discovery.relabel.logs_integrations_docker.rules | |
forward_to = [loki.write.cockpitloki.receiver] | |
} | |
loki.write "cockpitloki" { | |
endpoint { | |
url = "<LOKI_URL>/loki/api/v1/push" | |
headers = { | |
"X-TOKEN" = "<LOKI_TOKEN>", | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment