Authentication for Alloy Proxy Setup

  • What Grafana version and what operating system are you using? alloy, version v1.9.2 using Rocky 9.5

  • What are you trying to achieve? Setting up authentication ( any kind ) between Alloy agent and Alloy proxy

  • How are you trying to achieve it? using prometheus.receive_http

  • What happened? i cant seem to setup any kind of authentication between then so only authenticated servers can send data

  • What did you expect to happen? tried http {} block but its not working

  • Can you copy/paste the configuration(s) that you are having problems with? Yes here it is: http {
    auth {
    basic {
    username = “admin”
    password = “/etc/alloy/secrets/mimir-password”
    }
    filter {
    paths = [“/metrics”, “/v1”]
    authenticate_matching_paths = true
    }
    }
    }

    prometheus.receive_http “receiver” {
    http {
    listen_address = “0.0.0.0”
    listen_port = 9201
    }
    auth {}
    forward_to = [prometheus.remote_write.mimir.receiver]
    }

    prometheus.remote_write “mimir” {
    endpoint {
    url = “http://mimir:8082/api/v1/push”
    basic_auth {
    username = “admin”
    password_file = “/etc/alloy/secrets/mimir-password”
    }
    headers = {
    “X-Scope-OrgID” = “default”,
    }
    }
    external_labels = {
    datacenter = “CAL”,
    }
    }

    prometheus.exporter.unix “default” {
    include_exporter_metrics = true
    disable_collectors = [“mdadm”]
    }

    prometheus.scrape “default” {
    targets = prometheus.exporter.unix.default.targets

    forward_to = [
    prometheus.remote_write.mimir.receiver,
    ]
    }

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were. When i tried auth inside receiver_http it doesnt exist

  • Did you follow any online instructions? If so, what is the URL? Did not find any accurate ones

Looking at the HTTP block I don’t see a way to configure simple auth.

Not sure how you segment your network, but I don’t think this is a common use case. If you really want authentication on an Alloy proxy, putting alloy behind nginx with simple auth might be your easiest workaround.