clanServices: jail telegraf-json to not write to tmp dir
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
jsonpath = "/tmp/telegraf.json";
|
|
||||||
auth_user = "prometheus";
|
auth_user = "prometheus";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -59,9 +58,22 @@
|
|||||||
after = [ "telegraf.service" ];
|
after = [ "telegraf.service" ];
|
||||||
wants = [ "telegraf.service" ];
|
wants = [ "telegraf.service" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
LoadCredential = [
|
||||||
|
"auth_file_path:${config.clan.core.vars.generators.telegraf.files.miniserve-auth.path}"
|
||||||
|
];
|
||||||
|
Environment = [
|
||||||
|
"AUTH_FILE_PATH=%d/auth_file_path"
|
||||||
|
];
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
User = "telegraf";
|
||||||
|
Group = "telegraf";
|
||||||
};
|
};
|
||||||
script = "${pkgs.miniserve}/bin/miniserve -p 9990 ${jsonpath} --auth-file ${config.clan.core.vars.generators.telegraf.files.miniserve-auth.path}";
|
script = "${pkgs.miniserve}/bin/miniserve -p 9990 /var/lib/telegraf/telegraf.json --auth-file \"$AUTH_FILE_PATH\"";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.telegraf = {
|
||||||
|
home = "/var/lib/telegraf";
|
||||||
|
createHome = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.telegraf = {
|
services.telegraf = {
|
||||||
@@ -107,7 +119,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs.file = {
|
outputs.file = {
|
||||||
files = [ jsonpath ];
|
files = [ "/var/lib/telegraf/telegraf.json" ];
|
||||||
data_format = "json";
|
data_format = "json";
|
||||||
json_timestamp_units = "1s";
|
json_timestamp_units = "1s";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
|
|
||||||
peer1.wait_for_unit("network-online.target")
|
peer1.wait_for_unit("network-online.target")
|
||||||
peer1.wait_for_unit("telegraf.service")
|
peer1.wait_for_unit("telegraf.service")
|
||||||
|
|
||||||
peer1.wait_for_unit("telegraf-json.service")
|
peer1.wait_for_unit("telegraf-json.service")
|
||||||
peer1.succeed("curl http://localhost:9990")
|
peer1.succeed("curl http://localhost:9990")
|
||||||
peer1.succeed("curl http://localhost:9273/metrics")
|
peer1.succeed("curl http://localhost:9273/metrics")
|
||||||
|
|||||||
Reference in New Issue
Block a user