Menu
Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Open source
02 Datasources
Datasources are a powerful concept in gomplate. They allow you to reach out to other files, systems and resources to pull data.
docker run -v ${PWD}/:/etc/grafana grafana/agentctl:latest template-parse file:///etc/grafana/02_config.yml
Config
The config.yml adds a new field sources
. Sources can be any number of things defined in the gomplate datasources documentation. In this example using fruit.
yaml
template_paths:
- "file:///etc/grafana/01_assets"
datasources:
- name: fruit
url: "file://etc/grafana/01_assets/fruit.json"
json
["mango","peach","orange"]
Usage
yaml
server:
log_level: debug
metrics:
wal_directory: /tmp/grafana-agent-normal
global:
scrape_interval: 60s
remote_write:
- url: https://prometheus-us-central1.grafana.net/api/prom/push
basic_auth:
username: xyz
password: secretpassword
configs:
- name: default
{{ range (datasource "fruit") }}
- name: {{ . }}
{{ end }}
A Datasource is reference by name and in this case it is an array and used exactly like the looping example.
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video
Getting started with Grafana dashboard design
In this webinar, you'll learn how to design stylish and easily accessible Grafana dashboards that tell a story.
Video
Building advanced Grafana dashboards
In this webinar, we’ll demo how to build and format Grafana dashboards.
Video
Intro to Alerting with Grafana
Master alerting with Grafana: Navigate the complexities, reduce false positives, and boost reliability for your systems.