From 803d1efa8fba346de5dfe710a1b667b19f82d56e Mon Sep 17 00:00:00 2001 From: nyanloutre Date: Sun, 1 Apr 2018 15:04:49 +0200 Subject: [PATCH] Ajout Telegraf-InfluxDB-Grafana --- configuration.nix | 1 + hardware-configuration.nix | 5 +++++ services.nix | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 services.nix diff --git a/configuration.nix b/configuration.nix index ffc1587..5b32b1f 100644 --- a/configuration.nix +++ b/configuration.nix @@ -9,6 +9,7 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ./users.nix + ./services.nix ]; # Use the systemd-boot EFI boot loader. diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 4df7b58..7b3d787 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -47,6 +47,11 @@ fsType = "zfs"; }; + fileSystems."/mnt/influxdb" = + { device = "loutrepool/etc/influxdb"; + fsType = "zfs"; + }; + swapDevices = [ ]; nix.maxJobs = lib.mkDefault 4; diff --git a/services.nix b/services.nix new file mode 100644 index 0000000..3e117e7 --- /dev/null +++ b/services.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +{ + services.influxdb.enable = true; + services.influxdb.dataDir = "/mnt/influxdb"; + + services.telegraf.enable = true; + services.telegraf.extraConfig = { + inputs = { + zfs = { poolMetrics = true; }; + net = { interfaces = [ "eno1" "eno2" "eno3" "eno4" ]; }; + netstat = {}; + cpu = { totalcpu = true; }; + kernel = {}; + mem = {}; + processes = {}; + system = {}; + }; + outputs = { + influxdb = { database = "telegraf"; urls = [ "http://localhost:8086" ]; }; + }; + }; + + services.grafana.enable = true; + services.grafana.addr = "0.0.0.0"; + networking.firewall.allowedTCPPorts = [ 3000 ]; +}