Caution
Grafana Agent has reached End-of-Life (EOL) on November 1, 2025. Agent is no longer receiving vendor support and will no longer receive security or bug fixes. Current users of Agent Static mode, Agent Flow mode, and Agent Operator should proceed with migrating to Grafana Alloy. If you have already migrated to Alloy, no further action is required. 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.
module.http
BETA: This is a beta component. Beta components are subject to breaking changes, and may be replaced with equivalent functionality that cover the same use case.
module.http is a module loader component.
module.http embeds a remote.http component to retrieve the module from a remote
HTTP server. This allows you to use a single module loader, rather than a remote.http
component paired with a module.string component.
Usage
module.http "LABEL" {
url = URL
arguments {
MODULE_ARGUMENT_1 = VALUE_1
...
}
}Arguments
The following arguments are supported:
Blocks
The following blocks are supported inside the definition of module.http:
arguments block
The arguments block specifies the list of values to pass to the loaded
module.
The attributes provided in the arguments block are validated based on the
argument blocks defined in the module source:
If a module source marks one of its arguments as required, it must be provided as an attribute in the
argumentsblock of the module loader.Attributes in the
argumentblock of the module loader are rejected if they are not defined in the module source.
Exported fields
The following fields are exported and can be referenced by other components:
exports exposes the export config block inside a module. It can be accessed
from the parent config via module.http.LABEL.exports.EXPORT_LABEL.
Values in exports correspond to export blocks defined in the module
source.
Component health
module.http is reported as healthy if the most recent load of the module was
successful.
Before the first load of the module, the health is reported as Unknown.
If the module is not loaded successfully, the current health displays as unhealthy, and the health includes the error from loading the module.
Debug information
module.http does not expose any component-specific debug information.
Debug metrics
module.http does not expose any component-specific debug metrics.
Example
In this example, the module.http component loads a module from a locally running
HTTP server, polling for changes once every minute.
The module sets up a Redis exporter and exports the list of targets to the parent config to scrape and remote write.
Parent:
module.http "remote_module" {
url = "http://localhost:8080/redis_module.yaml"
poll_frequency = "1m"
}
prometheus.exporter.unix "default" { }
prometheus.scrape "local_agent" {
targets = concat(prometheus.exporter.unix.default.targets, module.http.remote_module.exports.targets)
forward_to = [module.http.metrics.exports.prometheus_remote_write.receiver]
scrape_interval = "10s"
}
prometheus.remote_write "default" {
endpoint {
url = PROMETHEUS_REMOTE_WRITE_URL
basic_auth {
username = USERNAME
password = PASSWORD
}
}
}Replace the following:
PROMETHEUS_REMOTE_WRITE_URL: The URL of the Prometheus remote_write-compatible server to send metrics to.USERNAME: The username to use for authentication to the remote_write API.PASSWORD: The password to use for authentication to the remote_write API.
Module:
prometheus.exporter.redis "local_redis" {
redis_addr = REDIS_ADDR
redis_password_file = REDIS_PASSWORD_FILE
}
export "redis_targets" {
value = prometheus.exporter.redis.local_redis.targets
}Replace the following:
REDIS_ADDR: The address of your Redis instance.REDIS_PASSWORD_FILE: The path to a file containing the password for your Redis instance.



