Install Grafana Alloy on Ubuntu Server 24.04

  • What Grafana version and what operating system are you using?
    Ubuntu Server 24.04 LTS

  • What are you trying to achieve?
    Server monitoring

  • How are you trying to achieve it?
    I go to Connections, choose Linux Server,

  1. Select platform → Debian - AMD64
  2. Install Grafana Alloy → Run Grafana Alloy
    Choose a name and create API token.
    Copy the long command to clipboard and run it on my server.

The command output:

--- Using package system deb. Downloading and installing package for amd64
############################################################################################################################################################################# 100.0%
--- Verifying package checksum
Selecting previously unselected package alloy.
(Reading database ... 173781 files and directories currently installed.)
Preparing to unpack /tmp/alloy-1.7.4-1.amd64.deb ...
Unpacking alloy (1.7.4-1) ...
Setting up alloy (1.7.4-1) ...
--- Retrieving config and placing in /etc/alloy/config.alloy
--- Verifying config checksum
--- Creating systemd override file for environment variables
--- Enabling and starting alloy.service
Created symlink /etc/systemd/system/multi-user.target.wants/alloy.service → /usr/lib/systemd/system/alloy.service.

Alloy is now running!

To check the status of Alloy, run:
   sudo systemctl status alloy.service
To restart Alloy, run:
   sudo systemctl restart alloy.service
The config file is located at:
   /etc/alloy/config.alloy

systemctl status alloy shows Active (running), no errors

I see alloy in processes (top)

  • What happened?
    I press Test Alloy connection and it fails:
    Oops! Something went wrong. Make sure the install instructions were copied correctly and check for any optional configurations. If you’re still running into issues, read the troubleshooting instructions.

  • What did you expect to happen?
    Successful connection

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    no errors

  • Did you follow any online instructions? If so, what is the URL?
    Linux Server integration | Grafana Cloud documentation

contents of /etc/alloy/config.alloy

remotecfg {
        url            = "https://fleet-management-prod-016.grafana.net"
        id             = "moodlserver"
        poll_frequency = "60s"

        basic_auth {
                username = "1207440"
                password = "LONG_KEY"
        }
}

prometheus.remote_write "metrics_service" {
        endpoint {
                url = "https://prometheus-prod-39-prod-eu-north-0.grafana.net/api/prom/push"

                basic_auth {
                        username = "2339119"
                        password = "LONG_KEY"
                }
        }
}

loki.write "grafana_cloud_loki" {
        endpoint {
                url = "https://logs-prod-025.grafana.net/loki/api/v1/push"

                basic_auth {
                        username = "1165237"
                        password = "LONG_KEY"
                }
        }
}

Welcome @pkmcnc

I think you are confusing Alloy with a datasource, such as Prometheus.

Looks like you successfully installed Alloy on your Linux server without any issues. Great! It would appear that you are sending the metrics to Prometheus hosted in Grafana Cloud and the logs to Loki hosted in Grafana Cloud, correct?

So in Grafana, have you added the datasources of Prometheus (in Grafana Cloud) and Loki (in Grafana Cloud)? If you add them successfully, you should see your metrics and logs being scraped by Alloy in those datasources.

Hi @grant2
Thanks a lot for your reply!
Everything is working now.
Still, “Test Alloy connection” failed until I set up integrations. After that everything went smooth.
The same happened with the second server. So probably something is wrong with that test.