feat(nasp): improve telegraf metrics

This commit is contained in:
Dict Xiong 2024-06-15 13:49:18 +08:00
parent 5448b77232
commit 9daecf46a7

View File

@ -285,15 +285,50 @@ in
timeout = "5s";
};
inputs.system = {
name_override = "load";
name_override = "system";
tags = { bucket = telegrafCfg.bucket; };
fieldpass = [ "load1" "bucket" ];
interval = "15s";
interval = "10s";
};
inputs.cpu = {
percpu = false;
name_override = "cpu";
tags = { bucket = telegrafCfg.bucket; };
};
inputs.kernel = {
name_override = "kernel";
tags = { bucket = telegrafCfg.bucket; };
interval = "10s";
};
inputs.processes = {
name_override = "processes";
tags = { bucket = telegrafCfg.bucket; };
interval = "10s";
};
inputs.mem = {
name_override = "memory";
tags = { bucket = telegrafCfg.bucket; };
fieldpass = [ "used" "total" "bucket"];
interval = "10s";
};
inputs.disk = {
ignore_fs = ["tmpfs" "devtmpfs" "devfs" "iso9660" "overlay" "aufs" "squashfs"];
name_override = "disk";
tags = { bucket = telegrafCfg.bucket; };
interval = "30s";
};
inputs.diskio = {
name_override = "diskio";
tags = { bucket = telegrafCfg.bucket; };
};
inputs.net = {
name_override = "net";
ignore_protocol_stats = true;
tags = { bucket = telegrafCfg.bucket; };
};
inputs.smart = {
path_smartctl = "/run/current-system/sw/bin/smartctl";
use_sudo = true;
name_override = "smartctl";
tags = { bucket = telegrafCfg.bucket; };
interval = "30s";
};
inputs.temp = {
@ -302,6 +337,9 @@ in
};
};
};
security.sudo.extraConfig = ''
%telegraf ALL = (root) NOPASSWD: /run/current-system/sw/bin/smartctl
'';
})
# g series
(lib.mkIf (gCfg.enable) (let
@ -394,11 +432,6 @@ in
bucket = "g-series";
};
services.telegraf.extraConfig = {
inputs.net = {
interfaces = [ gCfg.eth0Name gCfg.eth1Name gCfg.eth2Name ];
ignore_protocol_stats = true;
tags = { bucket = "g-series"; };
};
inputs.nvidia_smi = {
bin_path = "/run/current-system/sw/bin/nvidia-smi";
tags = { bucket = "g-series"; };