How toLinuxUbuntu

Ubuntu 24.04: How to install Grafana Alloy

Grafana Alloy in Ubuntu 24.04, dance collections of matrics.

What’s Grafana Alloy

Grafana Alloy is a vendor-neutral distribution of the OpenTelemetry (OTel) Collector. Alloy offers native pipelines for OTel, Prometheus, Pyroscope, Loki, and many other metrics, logs, traces, and profile tools. In addition, you can use Alloy pipelines to do different tasks, such as configure alert rules in Loki and Mimir. Alloy is fully compatible with the OTel Collector, Prometheus Agent, and Promtail.


How to Install Grafana Alloy in Linux Ubuntu 24.04

Install Requirement Package

apt install gpg

Setup Grafana Alloy Repository

mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

Refresh apt

apt update

Install Grafana Alloy

apt install alloy -y

Enable and start the services

systemctl enable alloy
systemctl start alloy

Configuration Grafana Allow to Grafana Cloud as Prometheus

Edit Grafana Allow Config file

vim /etc/alloy/config.alloy

Forward to Grafana Cloud


logging {
  level = "warn"
}

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

prometheus.remote_write "grafanacloud" {
  endpoint {
    url = "https://$your_uri.grafana.net/api/prom/push"

    basic_auth {
      username = "$user"
      password = "$passwd"
    }
  }
}

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

  forward_to = [prometheus.remote_write.grafanacloud.receiver]
}

Apply Changed of Config File

systemctl restart alloy

Ref

Hi, I’m Sysadmin.ID

Leave a Reply

Your email address will not be published. Required fields are marked *