modules: refactor telegraf
This commit is contained in:
parent
4726c2562c
commit
21c49c5357
4 changed files with 21 additions and 5 deletions
modules
|
@ -1,11 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
../../shared/telegraf.nix
|
||||
];
|
||||
|
||||
services.telegraf = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
agent.interval = "60s";
|
||||
inputs = {
|
||||
prometheus.metric_version = 2;
|
||||
smart.path_smartctl = "${pkgs.smartmontools}/bin/smartctl";
|
||||
system = { };
|
||||
mem = { };
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
./reboot.nix
|
||||
./security.nix
|
||||
./sops-nix.nix
|
||||
./telegraf.nix
|
||||
./users.nix
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.srvos.nixosModules.mixins-telegraf
|
||||
inputs.srvos.nixosModules.server
|
||||
];
|
||||
|
||||
|
@ -24,9 +24,6 @@
|
|||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 9273 ];
|
||||
services.telegraf.extraConfig.inputs.prometheus.metric_version = 2;
|
||||
|
||||
srvos.flake = inputs.self;
|
||||
|
||||
boot.kernelPackages = pkgs.lib.mkIf (!config.boot.supportedFilesystems.zfs or false) pkgs.linuxPackages_latest;
|
||||
|
|
9
modules/nixos/common/telegraf.nix
Normal file
9
modules/nixos/common/telegraf.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.srvos.nixosModules.mixins-telegraf
|
||||
../../shared/telegraf.nix
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 9273 ];
|
||||
}
|
7
modules/shared/telegraf.nix
Normal file
7
modules/shared/telegraf.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
services.telegraf.extraConfig.inputs = {
|
||||
prometheus = {
|
||||
metric_version = 2;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue