2023-07-05 12:04:30 +02:00
|
|
|
{ config, pkgs, hostname, ... }: {
|
|
|
|
# Telegraf Monitoring
|
|
|
|
|
2023-07-05 12:47:56 +02:00
|
|
|
sops.secrets.telegraf-token = {
|
2023-07-05 12:04:30 +02:00
|
|
|
owner = "telegraf";
|
|
|
|
sopsFile = ../secrets/secrets.yaml;
|
|
|
|
restartUnits = [ "telegraf.service" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Install the package
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
lm-sensors
|
|
|
|
telegraf
|
|
|
|
];
|
|
|
|
|
|
|
|
# Configure the package:
|
|
|
|
services.telegraf = {
|
|
|
|
enable = true;
|
2023-07-05 12:52:22 +02:00
|
|
|
environmentFiles = [ /run/secrets/telegraf-token ];
|
2023-07-05 12:04:30 +02:00
|
|
|
extraConfig = {
|
2023-07-05 12:47:56 +02:00
|
|
|
outputs = {
|
|
|
|
influxdb_v2 = {
|
|
|
|
urls = [ "https://influx.sysctl.io/" ];
|
2023-07-05 12:53:01 +02:00
|
|
|
token = "$TELEGRAF_TOKEN";
|
2023-07-05 12:47:56 +02:00
|
|
|
organization = "default";
|
|
|
|
bucket = "telegrafdb";
|
2023-07-05 12:53:22 +02:00
|
|
|
http_headers = "{ \"Authorization\" = \"Token $TELEGRAF_TOKEN}\" }";
|
2023-07-05 12:47:56 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
inputs = {
|
|
|
|
cpu = {
|
|
|
|
percpu = true;
|
|
|
|
totalcpu = true;
|
|
|
|
collect_cpu_time = false;
|
|
|
|
report_active = false;
|
|
|
|
};
|
|
|
|
disk = {
|
2023-07-05 12:54:24 +02:00
|
|
|
ignore_fs = "[ \"tmpfs\", \"devtmpfs\", \"devfs\", \"iso9660\", \"overlay\", \"aufs\", \"squashfs\" ]";
|
2023-07-05 12:47:56 +02:00
|
|
|
};
|
|
|
|
diskio = {};
|
|
|
|
kernel = {};
|
|
|
|
mem = {};
|
|
|
|
processes = {};
|
|
|
|
swap = {};
|
|
|
|
system = {};
|
|
|
|
fail2ban = {};
|
|
|
|
hddtemp = {};
|
|
|
|
intel_powerstat = {};
|
|
|
|
net = {};
|
|
|
|
nvidia_smi = {};
|
|
|
|
sensors = {};
|
|
|
|
smart = {
|
|
|
|
timeout = "30s"
|
|
|
|
};
|
|
|
|
temp = {};
|
|
|
|
wireless = {};
|
|
|
|
};
|
2023-07-05 12:04:30 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|