3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #183269 from flokli/grafana-agent-merge-defaults

nixos/grafana-agent: ensure defaults are merged
This commit is contained in:
Jörg Thalheim 2022-07-29 11:38:47 +01:00 committed by GitHub
commit dfda4ec196
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,9 +48,10 @@ in
freeformType = settingsFormat.type;
};
default = {
default = { };
defaultText = ''
metrics = {
wal_directory = "\${STATE_DIRECTORY}";
wal_directory = "\''${STATE_DIRECTORY}";
global.scrape_interval = "5s";
};
integrations = {
@ -59,8 +60,7 @@ in
node_exporter.enabled = true;
replace_instance_label = true;
};
};
'';
example = {
metrics.global.remote_write = [{
url = "\${METRICS_REMOTE_WRITE_URL}";
@ -104,6 +104,20 @@ in
};
config = mkIf cfg.enable {
services.grafana-agent.settings = {
# keep this in sync with config.services.grafana-agent.settings.defaultText.
metrics = {
wal_directory = mkDefault "\${STATE_DIRECTORY}";
global.scrape_interval = mkDefault "5s";
};
integrations = {
agent.enabled = mkDefault true;
agent.scrape_integration = mkDefault true;
node_exporter.enabled = mkDefault true;
replace_instance_label = mkDefault true;
};
};
systemd.services.grafana-agent = {
wantedBy = [ "multi-user.target" ];
script = ''