Data configurationMetricsShip your metrics to Grafana Cloud without an integration

Ship your metrics to Grafana Cloud without an integration

If you want to ship your Prometheus metrics to Grafana Cloud, but there isn’t an integration available, you can either use an existing Prometheus exporter, or write one of your own, and deploy Grafana Agent to scrape your local machine or service.

  1. Find and install an exporter.

    There are many open source Prometheus exporters available on GitHub. For a list of Prometheus exporters, see Third-party exporters in the Prometheus documentation. Note that this list is not complete, and you can find additional exporters on other sites.

    If you can’t find an existing exporter for your service, you can write your own. For more information, see Writing exporters in the Prometheus documentation.

Configure the Agent

You can generate the Agent binary and configuration file for your service or machine in your Grafana Cloud stack.

  1. In your Grafana Cloud stack, click the Integrations and Connections icon (lightening bolt).

  2. Beneath the search field, click Filter by category and select Hosted data.

  3. Click Hosted Prometheus metrics.

  4. Select the following options:

    • Choose a method for forwarding metrics: Via Grafana Agent

      Select this method if you do not already have a local Prometheus instance running.

    • Show instructions for: Standard

    • Choose your platform: Select the operating system of the machine or service.

      If you don’t see your binary option displayed, see Agent releases and scroll down to the Assets list to install the binary manually. For more information on installing the Grafana binary, see Install the Grafana Agent binary.

    • Download and install the binary for your OS

      Run the displayed commands in a terminal to download and install the binary if you’ve selected one.

    • Set the configuration

      • Select Create new config to create a new configuration file. Choose this option if this is your first time deploying the Agent.

        If you are creating your first Agent configuration file, you can copy the command provided in the UI, adding your job name to the job_name field and the URL of your machine or service to the targets field . Run this command from your terminal, in the directory where you installed the Agent binary.

      • Select Update existing config manually to generate the settings to add to an existing configuration file.

        If you are adding remote_write to an existing configuration file, add the content generated in the UI to the metrics section of the file. You must also add the scrape_config details for this scrape job. If you already have remote_write enabled, and scrape jobs running, you may only need to add the scrape job details to scrape_configs.

      The following is an example of a simple Agent configuration file with remote_write enabled:

        metrics:
          configs:
            - name: integrations
              remote_write:
                - basic_auth:
                    password:
                    username:
                  url: https://prometheus-blocks-prod-us-central1.grafana.net/api/prom/push
              scrape_configs:
                - job_name: sglk
                  static_configs:
                    - targets: ['localhost:4001']
          global:
            scrape_interval: 60s
          wal_directory: /tmp/grafana-agent-wal
      
  5. Save your changes and restart the agent.

  ./<NAME_AGENT_BINARY> --config.file=agent-config.yaml