Basic Grafana Alloy config to connect alloy to cloud

  • What Grafana version and what operating system are you using?
    Grafana Cloud + grafana alloy agent

  • What are you trying to achieve?
    A basic alloy config to connect my agent to my cloud

  • How are you trying to achieve it?
    I read documentation and I’m far to understand how it works

I installed an alloy agent with ‘dnf install alloy’. It came with an example default /etc/alloy/config.alloy

// Sample config for Alloy.
//
// For a full configuration reference, see https://grafana.com/docs/alloy


logging {
  level = "warn"
}

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

prometheus.scrape "default" {
  targets = concat(
    prometheus.exporter.unix.default.targets,
    [{
      // Self-collect metrics
      job         = "alloy",
      __address__ = "127.0.0.1:12345",
    }],
  )

  forward_to = [
  // TODO: components to forward metrics to (like prometheus.remote_write or
  // prometheus.relabel).
  ]
}

The thing is, days ago I installed a grafana agent flow and I used the config creator to have this settings:

module.git “grafana_cloud” {
repository = “GitHub - grafana/agent-modules: A repository of public agent modules
path = “modules/grafana-cloud/autoconfigure/module.river”
revision = “main”
pull_frequency = “0s”
arguments {
stack_name = “mystackasdasdasd”
token = env(“glc_mykeysdfsdfdsfsdfsdfsdfsdfsd”)
}
}

How can I apply those setting to the new alloy format?

Thank you in advance

Modules seem to work a little different in Alloy compared to Agent.

You can find the Grafana Cloud module for Alloy and an example on how to use it in the grafana/alloy-modules (github.com) repository.

You can also take a look at the Modules page on the Grafana Alloy docs in case you want to learn more about modules.

Hope this helps!

1 Like

Thank you very muck Goofy.
I bet that will help, yep D