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, ... }:
|
{ 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 = { };
|
||||||
|
|
|
@ -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;
|
||||||
|
|
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
Add a link
Reference in a new issue