Menu
Grafana Cloud

Install Grafana Agent

There are several ways to install and run Grafana Agent. This procedure shows the recommended way of installing the agent using a script for Debian and Red Hat-based systems. For other Linux distributions, or if you prefer to install the binary directly rather than as a package, see Installing the binary directly without our script for all other use cases**.

For both methods, begin by accessing the Connections section from the Home menu located near the top left-hand side of the page:

  1. In your Grafana Cloud instance, click on Connections.
  2. Select an integration to install and click Install Integration.
  3. Choose your operating system:

Install with the provided script for Debian- and Red Hat-based systems

This preferred installation method automates the installation for systems that use DEB or RPM packages, such as with Debian- or Red Hat-based systems. The provided script checks and finds which is appropriate for your system and then uses your package manager for the Grafana Agent install. It also sets up the agent to be managed and run as a systemd service.

This method runs Agent using a newly-created user, grafana-agent. If you are collecting logs, for example, you may need to give this user access to log-containing directories.

Note: The configuration for Grafana Agent is stored in /etc/grafana-agent.yaml. This file is overwritten each time the script is run, adding and removing integration changes made in the Grafana Cloud UI. If you have custom configurations that you want to use, you can create and maintain your own custom configuration file by changing the environment variable in /etc/default/grafana-agent to point to your custom configuration file instead of the default location.
  1. Copy and run the provided script.
  2. Start the service using the provided systemd command.
  3. Click Check Connection to confirm metrics are being received.
Note: This method also makes it easy to retrieve and review Grafana Agent logs using systemd.

To retrieve service logs for the agent, enter:

sudo journalctl -b -u grafana-agent.service

Uninstall Grafana Agent

How you uninstall depends on which Linux distribution you’re running and how you installed Grafana Agent.

The script method installs a system package called grafana-agent. This means that:

  • For Debian-based systems, you can remove the agent using sudo apt remove grafana-agent
  • For Red Hat-based systems, you can remove the agent using sudo dnf remove grafana-agent

If you installed using the “Other distribution” step, the agent is not persisted anywhere. The binary is only downloaded to the directory you ran the install steps in. Stop any running process and then delete the binary to uninstall.