Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
+++
draft = "True"
+++
# Grafana Agent Documentation

<p align="center"><img src="assets/logo_and_name.png" alt="Grafana Agent logo"></p>
This directory contains documentation for Grafana Agent. It is split into two
parts:

Grafana Agent is an telemetry collector for sending metrics, logs,
and trace data to the opinionated Grafana observability stack. It works best
with:

* [Grafana Cloud](https://grafana.com/products/cloud/)
* [Grafana Enterprise Stack](https://grafana.com/products/enterprise/)
* OSS deployments of [Grafana Loki](https://grafana.com/oss/loki/), [Prometheus](https://prometheus.io/), [Cortex](https://cortexmetrics.io/), and [Grafana Tempo](https://grafana.com/oss/tempo/)


- Grafana Agent uses less memory on average than Prometheus – by doing less
(only focusing on `remote_write`-related functionality).
- Grafana Agent allows for deploying multiple instances of the Agent in a
cluster and only scraping metrics from targets that are running on the same host.
This allows for distributing memory requirements across the cluster
rather than pressurizing a single node.
* `user/`: Documentation for users. This directory is hosted on
[grafana.com/docs/agent](https://grafana.com/docs/agent/latest/) and we
recommend interacting with it there instead of viewing the markdown on
Github.
* `rfcs/`: RFCs for proposals relating to Grafana Agent.
19 changes: 0 additions & 19 deletions docs/cookbook/dynamic-configuration/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Dynamic Configuration uses a series of files to load templates. This example wil

## Dynamic Configuration

[config.yml](./01_config.yml)
[config.yml](01_config.yml)

```yaml
template_paths:
Expand All @@ -19,7 +19,7 @@ Tells the Grafana Agent where to load files from. It is important to note that d

Dynamic Configuration will find the first file matching pattern `agent-*.yml` and load that as the base. You can only have one agent template. If multiple matching templates are found then the configuration will fail to load.

[agent-1.yml](./01_assets/agent-1.yml)
[agent-1.yml](01_assets/agent-1.yml)

```yaml
server:
Expand Down Expand Up @@ -49,7 +49,7 @@ is a configuration block.

You can only have 1 server template.

[server-1.yml](./01_assets/server-1.yml)
[server-1.yml](01_assets/server-1.yml)


```yaml
Expand All @@ -59,6 +59,6 @@ log_level: info

## Final

[final.yml](./01_assets/final.yml)
[final.yml](01_assets/final.yml)

In the above example the `log_level: debug` block will be replaced with `log_level: info` from the server-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ the same agent-1 and server-1 yml from 01.

## Dynamic Configuration

[config.yml](./02_config.yml)
[config.yml](02_config.yml)

Tells the Grafana Agent where to load files from.

## Metrics

Dynamic Configuration will find the first file matching pattern `metrics-*.yml` and load that as the base. You can only have one metrics template.

[metrics-1.yml](./02_assets/metrics-1.yml)
[metrics-1.yml](02_assets/metrics-1.yml)

```yaml
configs:
Expand All @@ -30,7 +30,7 @@ wal_directory: /tmp/grafana-agent-wal

You can have any number of metrics_instances and they are added to any existing metrics instances defined previously.

[metrics_instances-1.yml](./02_assets/metrics_instances-1.yml)
[metrics_instances-1.yml](02_assets/metrics_instances-1.yml)

```yaml
name: instance1
Expand All @@ -41,7 +41,7 @@ scrape_configs:
- localhost:4000
```

[metrics_instances-2.yml](./02_assets/metrics_instances-2.yml)
[metrics_instances-2.yml](02_assets/metrics_instances-2.yml)

```yaml
name: instance2
Expand All @@ -54,7 +54,7 @@ scrape_configs:

## Final

[final.yml](./01_assets/final.yml)
[final.yml](01_assets/final.yml)

In the above you will see the `final.yml` includes all the instance configurations
- default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ Dynamic configuration requires the use of `integrations-next` feature flag, to a

## Dynamic Configuration

[config.yml](./03_config.yml)
[config.yml](03_config.yml)

Tells the Grafana Agent where to load files from.

## Integrations

Integrations are loaded from files matching `integrations-*.yml` and are combined together. You can declare for example multiple sets of `redis_exporter_configs` across several files.

[integrations-node.yml](./03_assets/integrations-node.yml)
[integrations-node.yml](03_assets/integrations-node.yml)

Note: You do NOT have to name the above file `integrations-node.yml` with `node`, `integrations-1.yml` would work the same. The name does NOT determine the type of integrations a template can contain and a template can contain integrations of different types.

```yaml
node_exporter: {}
```

[integrations-redis.yml](./03_assets/integrations-redis.yml)
[integrations-redis.yml](03_assets/integrations-redis.yml)

```yaml
redis_exporter_configs:
Expand All @@ -37,7 +37,7 @@ redis_exporter_configs:

## Final

[final.yml](./03_assets/final.yml)
[final.yml](03_assets/final.yml)

The final result should have 3 integrations enabled, 1 node_exporter and 2 redis_exporters.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Logs and Traces can also be templated. This is built ontop of the previous examp

## Dynamic Configuration

[config.yml](./04_config.yml)
[config.yml](04_config.yml)

Tells the Grafana Agent where to load files from.

## Logs

Logs are loaded from a template matching `logs-*.yml`. There can ONLY be 1 template loaded

[logs-1.yml](./04_assets/logs-1.yml)
[logs-1.yml](04_assets/logs-1.yml)

```yaml
configs:
Expand All @@ -29,7 +29,7 @@ configs:
expression: '\\temp\\Logs\\(?P<log_app>.+?)\\'
```

[traces.yml](./04_assets/traces-1.yml)
[traces.yml](04_assets/traces-1.yml)

```yaml
configs:
Expand All @@ -42,5 +42,5 @@ configs:

## Final

[final.yml](./04_assets/final.yml)
[final.yml](04_assets/final.yml)

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The templating is based on the excellent [gomplate](https://docs.gomplate.ca/) l

## Looping

[agent-1.yml](./01_assets/agent-1.yml)
[agent-1.yml](01_assets/agent-1.yml)

```yaml
server:
Expand All @@ -32,7 +32,7 @@ The templating engine uses directives that are wrapped in `{{ command }}`, in th

## Final

[final.yml](./01_assets/final.yml)
[final.yml](01_assets/final.yml)

The final.yml contains 4 prometheus configs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Datasources are a powerful concept in gomplate. They allow you to reach out to o

## Config

The [config.yml](./02_config.yml) adds a new field `sources`. Sources can be any number of things defined in the gomplate [datasources](https://docs.gomplate.ca/datasources/) documentation. In this example using fruit.
The [config.yml](02_config.yml) adds a new field `sources`. Sources can be any number of things defined in the gomplate [datasources](https://docs.gomplate.ca/datasources/) documentation. In this example using fruit.

```yaml
template_paths:
Expand All @@ -17,15 +17,15 @@ datasources:
url: "file://etc/grafana/01_assets/fruit.json"
```

[fruit.json](./02_assets/fruit.json)
[fruit.json](02_assets/fruit.json)

```json
["mango","peach","orange"]
```

## Usage

[agent-1.yml](./02_assets/agent-1.yml)
[agent-1.yml](02_assets/agent-1.yml)

```yaml
server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Datasources can also access objects.

## Config

The [config.yml](./02_config.yml) adds a new field `sources`. Sources can be any number of things defined in the gomplate [datasources](https://docs.gomplate.ca/datasources/) documentation. In this example using fruit.
The [config.yml](02_config.yml) adds a new field `sources`. Sources can be any number of things defined in the gomplate [datasources](https://docs.gomplate.ca/datasources/) documentation. In this example using fruit.

```yaml
template_paths:
Expand All @@ -17,7 +17,7 @@ datasources:
url: "file:///etc/grafana/03_assets/computers.json"
```

[computers.json](./03_assets/computers.json)
[computers.json](03_assets/computers.json)

```json
[
Expand All @@ -42,7 +42,7 @@ datasources:

## Usage

[agent-1.yml](./02_assets/agent-1.yml)
[agent-1.yml](02_assets/agent-1.yml)

```yaml
server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Unfortunately there is not a specific docker command but generic examples are be

## Looping

[agent-1.yml](./01_assets/agent-1.yml)
[agent-1.yml](01_assets/agent-1.yml)

```yaml
server:
Expand Down Expand Up @@ -36,4 +36,4 @@ The `aws.EC2Query` command is a new command added for Grafana Agent and takes a

## Final

[final.yml](./01_assets/final.yml)
[final.yml](01_assets/final.yml)
19 changes: 19 additions & 0 deletions docs/user/cookbook/dynamic-configuration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Dynamic Configuration Cookbook

The purpose of the cookbook is to guide you through common scenarios of using dynamic configuration. Each folder contains increasingly more complex use cases, but feel free to jump in wherever you feel appropriate.

## Basics

[Basics](01_Basics) covers
- [Structure](01_Basics/01_Structure.md) of how agent and server templates are loaded
- [Instances](01_Basics/02_Instances.md) of metrics and metrics instances are loaded
- [Integrations](01_Basics/03_Integrations.md) of how integrations are loaded
- [Logs and Traces](01_Basics/04_Logs_and_Traces.md) of how traces and logs are loaded

[Templates](02_Templates) covers
- [Looping](02_Templates/01_Looping.md) covers basic command usage and simple loops
- [Datasource](02_Templates/02_Datasources.md) covers usage of datasource which are external datastores you can use to pull in data
- [Datasources and Objects](02_Templates/03_Datasource_and_Objects.md) covers the usage of complex json objects

[Advanced Datasources](03_Advanced_Datasources) covers non file based datasources
- [AWS](03_Advanced_Datasources/01_AWS.md) covers querying EC2 for instances