This guide takes one Linux server from nothing to a full Grafana Cloud dashboard: CPU, memory, disks, network and logs, on the free plan. Grafana Alloy does all the collecting. You install it with one command, then write the collecting part of its config yourself, block by block, so you know what every line does. It follows the video step by step.
Grafana is the screen: dashboards, graphs and alerts. It doesn't collect anything by itself. Something has to run on your server, read the numbers and the logs, and ship them to a database. That something is called a collector.
Alloy is Grafana's own collector. It replaces the older Grafana Agent, Promtail and the node exporter, in one program.
In Grafana Cloud, both databases are already set up for you.
An Alloy config is made of components. Each component is one block that
does one job: collect data, process it, or send it somewhere. You connect them with
forward_to, and the output of one flows into the next. That chain is your
pipeline. This is the one you build here:
sudo. The video uses Ubuntu 24.04.
Debian works the same way, and RedHat too.The install command depends on your processor type, so check it first:
uname -m| Output | What it is | Pick in Grafana Cloud |
|---|---|---|
x86_64 | The usual Intel or AMD server | Amd64 |
aarch64 | An ARM processor | Arm64 |
Click Run Grafana Alloy. Alloy needs a token to prove to Grafana Cloud that it's allowed to send data.
web-01 in the video).set:alloy-data-write. This token can only send
data. It can't read your dashboards or change anything.Click Create token. Under the token is Remote Configuration. It lets you manage all your collectors from Grafana Cloud later, in Fleet Management. Leave it on. It doesn't change anything in this guide.
Grafana Cloud now shows the install command. It's one line: the addresses of your metrics and logs databases, your account IDs, and the token. The last part downloads Grafana's install script and runs it. It looks like this:
GCLOUD_HOSTED_METRICS_ID="<metrics-id>" GCLOUD_HOSTED_METRICS_URL="<metrics-url>" GCLOUD_HOSTED_LOGS_ID="<logs-id>" GCLOUD_HOSTED_LOGS_URL="<logs-url>" GCLOUD_FM_URL="<fleet-management-url>" GCLOUD_FM_POLL_FREQUENCY="60s" GCLOUD_FM_HOSTED_ID="<stack-id>" GCLOUD_FM_LOCAL_ATTRIBUTES="{}" ARCH="arm64" GCLOUD_RW_API_KEY="<your-token>" /bin/sh -c "$(curl -fsSL https://storage.googleapis.com/cloud-onboarding/alloy/scripts/install-linux.sh)"Copy yours from Grafana Cloud, not from here. The block above only shows
the shape. The real command has your own IDs, URLs and token filled in, and the
ARCH value you picked. Treat it like a password: anyone with the token
can send data into your account.
On the server, paste the command and press Enter. It asks for your
sudo password, because it installs a system package. It downloads Alloy,
writes a config file to /etc/alloy/config.alloy, and starts Alloy as a
system service. Check it:
systemctl status alloyYou want to see this line. Press Q to get your prompt back.
Active: active (running)
sudo cat /etc/alloy/config.alloy
You'll see three blocks. Here they are with the IDs and URLs replaced by placeholders
(the remotecfg block is shortened):
remotecfg {
url = "https://fleet-management-prod-<nnn>.grafana.net"
id = "web-01"
poll_frequency = "60s"
...
basic_auth {
username = "<stack-id>"
password = sys.env("GCLOUD_RW_API_KEY")
}
}
prometheus.remote_write "metrics_service" {
endpoint {
url = "https://prometheus-prod-<nn>-prod-<region>.grafana.net/api/prom/push"
basic_auth {
username = "<metrics-id>"
password = sys.env("GCLOUD_RW_API_KEY")
}
}
}
loki.write "grafana_cloud_loki" {
endpoint {
url = "https://logs-prod-<nnn>.grafana.net/loki/api/v1/push"
basic_auth {
username = "<logs-id>"
password = sys.env("GCLOUD_RW_API_KEY")
}
}
}
Every block is a component: its type first, then a
label you choose, in quotes. So
prometheus.remote_write "metrics_service" is a component of type
prometheus.remote_write with the label metrics_service.
remotecfg is the Fleet Management connection.prometheus.remote_write "metrics_service" sends metrics to your Grafana
Cloud Prometheus.loki.write "grafana_cloud_loki" sends logs to your Grafana Cloud Loki.
The token isn't written in this file. sys.env("GCLOUD_RW_API_KEY") reads it
from an environment variable that the installer saved in a protected file.
These blocks only send. Nothing here collects anything yet, so Grafana would stay empty. The next step adds the collecting part.
Open the file in nano:
sudo nano /etc/alloy/config.alloyPress Alt+/ to jump to the end of the file, and paste these lines after the blocks the installer wrote:
// METRICS: collect, scrape, send
prometheus.exporter.unix "linux" { }
prometheus.scrape "linux" {
targets = prometheus.exporter.unix.linux.targets
forward_to = [prometheus.remote_write.metrics_service.receiver]
}
// LOGS: read the systemd journal, send
loki.source.journal "linux" {
labels = { job = "integrations/node_exporter", instance = constants.hostname }
forward_to = [loki.write.grafana_cloud_loki.receiver]
}Save with Ctrl+O and Enter, then exit with Ctrl+X. Here is what each block does.
A node exporter built into Alloy. It reads CPU, memory, disks and network straight from
Linux. The label is linux. The empty { } means it runs with
its defaults.
It reads the exporter, by default every 60 seconds.
targets says what to read:
prometheus.exporter.unix.linux.targets is the exporter's type, then its
label, then the export you want, targets. That's how components talk to
each other.forward_to says where the data goes next: the
receiver of the remote write block from the top of the file.
The exporter also puts two labels on every metric: instance, the server's
name, and job. The ready-made Linux dashboards filter on exactly these
labels. Exporter, scrape, remote write: that's the metrics pipeline.
It reads the systemd journal, where Linux keeps the logs of every service.
labels adds a job and an instance, so you can
find these logs later. constants.hostname is the server's own name.forward_to sends the logs to the loki.write block.Check your labels. metrics_service and
grafana_cloud_loki are the labels Grafana Cloud's installer gave the
remote write and Loki write blocks. If yours are different, use your labels after
forward_to.
Restart Alloy so it loads the new config, then check the status again:
sudo systemctl restart alloy
systemctl status alloy
It should still say active (running). If you made a typo, it says
failed. This shows you the error with the exact line:
journalctl -u alloy
Alloy has its own web page on port 12345, but by default it only
answers on the server itself. To open it from your computer, edit
/etc/default/alloy:
sudo nano /etc/default/alloy
Find the CUSTOM_ARGS line (Ctrl+W searches in nano) and set
the listen address to 0.0.0.0, port 12345:
CUSTOM_ARGS="--server.http.listen-addr=0.0.0.0:12345"Only on a trusted network. This page has no login. Anyone who can reach port 12345 can see your pipeline.
Save, exit, restart Alloy, and get the server's IP address. It's the first one listed:
sudo systemctl restart alloy
hostname -IIn your browser, open http://SERVER-IP:12345.
prometheus.scrape.linux. You see its
arguments, and further down the exports and the debug info for its target: when it was
last scraped, and how long it took.Tip (not in the video): right after a restart, the scrape target can show as not scraped yet. The first scrape happens within 60 seconds, so reload the page after a minute.
web-01 in the video). Uptime, CPU, memory, disk and
network, all from the three blocks you wrote.Open Explore. Pick your Grafana Cloud Prometheus data source, switch the query editor to Code, type this and run the query:
node_load1
node_load1 is the server's load average over the last minute. The legend
shows its labels: the instance (web-01) and the
job the exporter added.
Switch to your Grafana Cloud Loki data source (its name ends in
-logs), and query by the instance label. Replace web-01 with
your server's hostname:
{instance="web-01"}Every line from the server's journal, searchable.
If your dashboards stay empty, start here:
journalctl -u alloy| What you see | Why |
|---|---|
systemctl status alloy says failed |
A typo in config.alloy. journalctl -u alloy
shows the exact line. |
| Alloy runs, but Grafana Cloud stays empty | Almost always the token, or a typo in a component name after
targets or forward_to. |
forward_to points at a component that doesn't exist |
Your installer used different labels than metrics_service or
grafana_cloud_loki. Copy the labels from the top of your own
file. |
| The dashboard has no data for your server | Check the instance picker at the top. The dashboards filter on
the instance and job labels. |
| You can't open port 12345 in the browser | CUSTOM_ARGS isn't set, or Alloy wasn't restarted after the
change. |
| Not sure where the data stops | Open the Alloy web UI. A component that isn't healthy, or a scrape target that was never scraped, shows you which block to fix. |
The whole setup on camera, from an empty Grafana Cloud account to the dashboard, including the Alloy web UI drawing the pipeline live:
One server and one pipeline is a lab. A company means many collectors, Fleet Management, labels that stay consistent, and alerts that wake up the right person. I'm a Grafana Champion, and I help teams set up monitoring and observability, from Alloy pipelines to dashboards and alerting. See my services, or tell me what you run and I'll tell you how I'd set it up.