You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// =============================
// Grafana Alloy - config.river
// Local Node Exporter -> Remote Mimir (single-tenant, no auth)
// =============================
prometheus.scrape "node" {
// List of targets (each target is a map with labels). __address__ is required.
// You can set job and instance here.
targets = [
{
"__address__" = "127.0.0.1:9100",
"job" = "node",
"instance" = "your-instance-name", // or sys.env("INSTANCE") if you want to use the instance name from the environment variable
},
]
forward_to = [prometheus.remote_write.to_mimir.receiver]
scrape_interval = "15s"
scrape_timeout = "10s"
}
prometheus.remote_write "to_mimir" {
endpoint {
url = "http://your-mimir-host:9009/api/v1/push"
// If you are using basic auth in the reverse proxy, enable this block
// basic_auth {
// username = "prom_rw"
// password = env("MIMIR_RW_PASSWORD")
// }
// If you are using multi-tenant, enable this block
// headers = {
// "X-Scope-OrgID" = "test"
// }
// Reasonable queue tuning
queue_config {
capacity = 10000
max_shards = 4
max_samples_per_send = 5000
batch_send_deadline = "5s"
min_backoff = "100ms"
max_backoff = "5s"
retry_on_http_429 = true
}
}
}
Create systemd service
sudo nano /etc/systemd/system/alloy.service
Add the following content to the file
[Unit]
Description=Grafana Alloy (metrics scraper & remote_write)
After=network-online.target
Wants=network-online.target
[Service]
User=alloy
Group=alloy
# Uncomment this if you want to use the instance name from the environment variable# Environment="INSTANCE=your-instance-name"
WorkingDirectory=/opt/alloy
ExecStart=/opt/alloy/bin/alloy run \
--server.http.listen-addr=127.0.0.1:12345 \
--storage.path=/opt/alloy/data \
/opt/alloy/config/config.river
Restart=always
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
Reload systemd
sudo systemctl daemon-reload
Enable Grafana Alloy to start on boot and start it
sudo systemctl enable --now alloy
Check Grafana Alloy status and ensure it is running