Skip to content

Grafana agent

services.grafana-agent.credentials

Credentials to load at service startup. Keys that are UPPER_SNAKE will be loaded as env vars. Values are absolute paths to the credentials.

Type: attribute set of string

Default

{ }

Example

{LOGS_REMOTE_WRITE_URL = "/run/keys/grafana_agent_logs_remote_write_url";LOGS_REMOTE_WRITE_USERNAME = "/run/keys/grafana_agent_logs_remote_write_username";METRICS_REMOTE_WRITE_URL = "/run/keys/grafana_agent_metrics_remote_write_url";METRICS_REMOTE_WRITE_USERNAME = "/run/keys/grafana_agent_metrics_remote_write_username";logs_remote_write_password = "/run/keys/grafana_agent_logs_remote_write_password";metrics_remote_write_password = "/run/keys/grafana_agent_metrics_remote_write_password";}

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/monitoring/grafana-agent.nix

services.grafana-agent.enable

Whether to enable grafana-agent. Type: boolean

Default

false

Example

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/monitoring/grafana-agent.nix

services.grafana-agent.extraFlags

Extra command-line flags passed to {command}grafana-agent.

See https://grafana.com/docs/agent/latest/static/configuration/flags/

Type: list of string

Default

[ ]

Example

["-enable-features=integrations-next""-disable-reporting"]

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/monitoring/grafana-agent.nix

services.grafana-agent.package

The grafana-agent package to use. Type: package

Default

pkgs.grafana-agent

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/monitoring/grafana-agent.nix

services.grafana-agent.settings

Configuration for {command}grafana-agent.

See https://grafana.com/docs/agent/latest/configuration/

Type: YAML value

Default

{metrics = {wal_directory = "\${STATE_DIRECTORY}";global.scrape_interval = "5s";};integrations = {agent.enabled = true;agent.scrape_integration = true;node_exporter.enabled = true;};}

Example

{logs = {configs = [{clients = [{basic_auth = {password_file = "\${CREDENTIALS_DIRECTORY}/logs_remote_write_password";username = "\${LOGS_REMOTE_WRITE_USERNAME}";};url = "\${LOGS_REMOTE_WRITE_URL}";}];name = "default";positions = {filename = "\${STATE_DIRECTORY}/loki_positions.yaml";};scrape_configs = [{job_name = "journal";journal = {labels = {job = "systemd-journal";};max_age = "12h";};relabel_configs = [{source_labels = ["__journal__systemd_unit"];target_label = "systemd_unit";}{source_labels = ["__journal__hostname"];target_label = "nodename";}{source_labels = ["__journal_syslog_identifier"];target_label = "syslog_identifier";}];}];}];};metrics = {global = {remote_write = [{basic_auth = {password_file = "\${CREDENTIALS_DIRECTORY}/metrics_remote_write_password";username = "\${METRICS_REMOTE_WRITE_USERNAME}";};url = "\${METRICS_REMOTE_WRITE_URL}";}];};};}

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/services/monitoring/grafana-agent.nix