modules: refactor telegraf

This commit is contained in:
zowoq 2024-05-04 18:51:58 +10:00
parent 4726c2562c
commit 21c49c5357
4 changed files with 21 additions and 5 deletions
modules

View file

@ -1,11 +1,14 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [
../../shared/telegraf.nix
];
services.telegraf = { services.telegraf = {
enable = true; enable = true;
extraConfig = { extraConfig = {
agent.interval = "60s"; agent.interval = "60s";
inputs = { inputs = {
prometheus.metric_version = 2;
smart.path_smartctl = "${pkgs.smartmontools}/bin/smartctl"; smart.path_smartctl = "${pkgs.smartmontools}/bin/smartctl";
system = { }; system = { };
mem = { }; mem = { };

View file

@ -7,9 +7,9 @@
./reboot.nix ./reboot.nix
./security.nix ./security.nix
./sops-nix.nix ./sops-nix.nix
./telegraf.nix
./users.nix ./users.nix
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.srvos.nixosModules.mixins-telegraf
inputs.srvos.nixosModules.server inputs.srvos.nixosModules.server
]; ];
@ -24,9 +24,6 @@
Restart = "on-failure"; Restart = "on-failure";
}; };
networking.firewall.allowedTCPPorts = [ 9273 ];
services.telegraf.extraConfig.inputs.prometheus.metric_version = 2;
srvos.flake = inputs.self; srvos.flake = inputs.self;
boot.kernelPackages = pkgs.lib.mkIf (!config.boot.supportedFilesystems.zfs or false) pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.lib.mkIf (!config.boot.supportedFilesystems.zfs or false) pkgs.linuxPackages_latest;

View file

@ -0,0 +1,9 @@
{ inputs, ... }:
{
imports = [
inputs.srvos.nixosModules.mixins-telegraf
../../shared/telegraf.nix
];
networking.firewall.allowedTCPPorts = [ 9273 ];
}

View file

@ -0,0 +1,7 @@
{
services.telegraf.extraConfig.inputs = {
prometheus = {
metric_version = 2;
};
};
}