From 12f2bf4bf8e280bc4e8f43d1e8fb4e6d993cef66 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 29 Dec 2023 17:03:35 +0100 Subject: [PATCH] move netdata to monitoring component --- nixos/components/default.nix | 1 + nixos/components/monitor/default.nix | 20 +++++++++++++++ nixos/components/monitor/netdata.nix | 33 +++++++++++++++++++++++++ nixos/machines/cherry/syncthing.nix | 4 --- nixos/machines/cream/configuration.nix | 2 +- nixos/machines/orbi/configuration.nix | 2 +- nixos/machines/robi/configuration.nix | 2 +- nixos/machines/sterni/configuration.nix | 2 +- nixos/system/proxy/default.nix | 2 +- nixos/system/server/default.nix | 2 +- nixos/system/server/netdata.nix | 26 ------------------- 11 files changed, 60 insertions(+), 36 deletions(-) create mode 100644 nixos/components/monitor/default.nix create mode 100644 nixos/components/monitor/netdata.nix delete mode 100644 nixos/system/server/netdata.nix diff --git a/nixos/components/default.nix b/nixos/components/default.nix index 4c429af..87fe572 100644 --- a/nixos/components/default.nix +++ b/nixos/components/default.nix @@ -4,6 +4,7 @@ ./gui ./mainUser.nix ./media + ./monitor ./network ./nixos ./terminal diff --git a/nixos/components/monitor/default.nix b/nixos/components/monitor/default.nix new file mode 100644 index 0000000..69192a7 --- /dev/null +++ b/nixos/components/monitor/default.nix @@ -0,0 +1,20 @@ +{ lib, ... }: +with lib; +with types; +{ + + + options.components.monitor = { + enable = mkOption { + type = bool; + default = true; + }; + }; + + imports = [ + ./netdata.nix + ]; + + + config = mkIf config.components.monitor.enable { }; +} diff --git a/nixos/components/monitor/netdata.nix b/nixos/components/monitor/netdata.nix new file mode 100644 index 0000000..a5a916b --- /dev/null +++ b/nixos/components/monitor/netdata.nix @@ -0,0 +1,33 @@ +{ lib, pkgs, config, ... }: +with lib; +with types; +{ + + config = lib.mkIf config.components.monitor.enable { + + services.netdata = { + enable = lib.mkDefault true; + # https://docs.netdata.cloud/daemon/config/ + config = { + global = { + "memory mode" = "ram"; + }; + }; + #configDir."python.d.conf" = pkgs.writeText "python.d.conf" '' + # example: yes + # default_run: no + # samba: yes + #''; + }; + + # add samba to path of python plugin + #systemd.services.netdata.path = [ pkgs.sudo pkgs.samba ]; + #systemd.services.netdata.serviceConfig.CapabilityBoundingSet = [ "~" ]; + #security.sudo.extraConfig = '' + # netdata ALL=(root) NOPASSWD: ${pkgs.samba}/bin/smbstatus + # netdata ALL=(root) NOPASSWD: /run/current-system/sw/bin/smbstatus + #''; + + + }; +} diff --git a/nixos/machines/cherry/syncthing.nix b/nixos/machines/cherry/syncthing.nix index e502a44..fb67123 100644 --- a/nixos/machines/cherry/syncthing.nix +++ b/nixos/machines/cherry/syncthing.nix @@ -20,10 +20,6 @@ enable = true; path = "/home/palo/.password-store"; }; - #private = { - # enable = true; - # path = "/home/palo/private"; - #}; art = { enable = true; path = "/home/palo/art"; diff --git a/nixos/machines/cream/configuration.nix b/nixos/machines/cream/configuration.nix index 9357464..de90958 100644 --- a/nixos/machines/cream/configuration.nix +++ b/nixos/machines/cream/configuration.nix @@ -6,7 +6,7 @@ # last system packages that need to be migrated to components ../../system/all/borg-jobs.nix #../../system/all/syncthing.nix - ../../system/server/netdata.nix + #../../system/server/netdata.nix ../../modules ../../components diff --git a/nixos/machines/orbi/configuration.nix b/nixos/machines/orbi/configuration.nix index 34b8885..6868704 100644 --- a/nixos/machines/orbi/configuration.nix +++ b/nixos/machines/orbi/configuration.nix @@ -5,7 +5,7 @@ ../../system/all/borg-jobs.nix ../../system/all/defaults.nix #../../system/all/syncthing.nix - ../../system/server/netdata.nix + #../../system/server/netdata.nix ../../system/server/packages.nix ../../components diff --git a/nixos/machines/robi/configuration.nix b/nixos/machines/robi/configuration.nix index aa28a9f..960233c 100644 --- a/nixos/machines/robi/configuration.nix +++ b/nixos/machines/robi/configuration.nix @@ -5,7 +5,7 @@ ../../system/all/borg-jobs.nix ../../system/all/defaults.nix #../../system/all/syncthing.nix - ../../system/server/netdata.nix + #../../system/server/netdata.nix ../../system/server/packages.nix ../../components diff --git a/nixos/machines/sterni/configuration.nix b/nixos/machines/sterni/configuration.nix index 3e86b63..4dbc9f0 100644 --- a/nixos/machines/sterni/configuration.nix +++ b/nixos/machines/sterni/configuration.nix @@ -4,7 +4,7 @@ ../../components ../../system/desktop - ../../system/server/netdata.nix + #../../system/server/netdata.nix ./hardware-configuration.nix ./packages.nix diff --git a/nixos/system/proxy/default.nix b/nixos/system/proxy/default.nix index c26ccf8..07a59cf 100644 --- a/nixos/system/proxy/default.nix +++ b/nixos/system/proxy/default.nix @@ -2,7 +2,7 @@ imports = [ ../../system/all - ../../system/server/netdata.nix + #../../system/server/netdata.nix ../../system/server/graylog-exporter.nix ../../system/server/prometheus-exporters.nix ]; diff --git a/nixos/system/server/default.nix b/nixos/system/server/default.nix index 75bfdfc..47c2365 100644 --- a/nixos/system/server/default.nix +++ b/nixos/system/server/default.nix @@ -2,7 +2,7 @@ imports = [ ../../system/all - ./netdata.nix + #./netdata.nix ./initssh.nix #./graylog-exporter.nix ./prometheus-exporters.nix diff --git a/nixos/system/server/netdata.nix b/nixos/system/server/netdata.nix deleted file mode 100644 index 84c069a..0000000 --- a/nixos/system/server/netdata.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, pkgs, ... }: { - services.netdata = { - enable = lib.mkDefault true; - # https://docs.netdata.cloud/daemon/config/ - config = { - global = { - "memory mode" = "ram"; - }; - }; - #configDir."python.d.conf" = pkgs.writeText "python.d.conf" '' - # example: yes - # default_run: no - # samba: yes - #''; - }; - - # add samba to path of python plugin - #systemd.services.netdata.path = [ pkgs.sudo pkgs.samba ]; - #systemd.services.netdata.serviceConfig.CapabilityBoundingSet = [ "~" ]; - #security.sudo.extraConfig = '' - # netdata ALL=(root) NOPASSWD: ${pkgs.samba}/bin/smbstatus - # netdata ALL=(root) NOPASSWD: /run/current-system/sw/bin/smbstatus - #''; - - -}