diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-12-27 15:36:09 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-12-27 15:36:09 +0100 |
commit | 6ee7783682e977f3ceebfb5a8ee8ddd1db3f7cc6 (patch) | |
tree | 783f1331c900aa63575e1f1589b0659d75d928dd /modules/private/monitoring/default.nix | |
parent | a0d2610c6d727095a43672f6285d907db9b9e2ff (diff) | |
download | Nix-6ee7783682e977f3ceebfb5a8ee8ddd1db3f7cc6.tar.gz Nix-6ee7783682e977f3ceebfb5a8ee8ddd1db3f7cc6.tar.zst Nix-6ee7783682e977f3ceebfb5a8ee8ddd1db3f7cc6.zip |
Add monitoring for dilion and quatresaisons
Diffstat (limited to 'modules/private/monitoring/default.nix')
-rw-r--r-- | modules/private/monitoring/default.nix | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/modules/private/monitoring/default.nix b/modules/private/monitoring/default.nix index 344e369..a298f92 100644 --- a/modules/private/monitoring/default.nix +++ b/modules/private/monitoring/default.nix | |||
@@ -16,13 +16,21 @@ let | |||
16 | else if config.myServices.databases.enable | 16 | else if config.myServices.databases.enable |
17 | then config.myServices.databases.postgresql.package | 17 | then config.myServices.databases.postgresql.package |
18 | else pkgs.postgresql; | 18 | else pkgs.postgresql; |
19 | zfsPlugin = pkgs.fetchurl { | ||
20 | url = "https://www.claudiokuenzler.com/monitoring-plugins/check_zpools.sh"; | ||
21 | sha256 = "0p9ms9340in80jkds4kfspw62xnzsv5s7ni9m28kxyd0bnzkbzhf"; | ||
22 | }; | ||
19 | myplugins = pkgs.runCommand "buildplugins" { | 23 | myplugins = pkgs.runCommand "buildplugins" { |
20 | buildInputs = [ pkgs.makeWrapper pkgs.perl ]; | 24 | buildInputs = [ pkgs.makeWrapper pkgs.perl ]; |
21 | } '' | 25 | } '' |
22 | mkdir $out | 26 | mkdir $out |
27 | cp ${zfsPlugin} $out/check_zpool.sh && chmod +x $out/check_zpool.sh | ||
23 | cp ${./plugins}/* $out/ | 28 | cp ${./plugins}/* $out/ |
24 | patchShebangs $out | 29 | patchShebangs $out |
25 | wrapProgram $out/check_command --prefix PATH : ${config.security.wrapperDir} | 30 | wrapProgram $out/check_command --prefix PATH : ${config.security.wrapperDir} |
31 | wrapProgram $out/check_zpool.sh --prefix PATH : ${lib.makeBinPath [ | ||
32 | pkgs.which pkgs.zfs pkgs.gawk | ||
33 | ]} | ||
26 | wrapProgram $out/send_nrdp.sh --prefix PATH : ${lib.makeBinPath [ | 34 | wrapProgram $out/send_nrdp.sh --prefix PATH : ${lib.makeBinPath [ |
27 | pkgs.curl pkgs.jq | 35 | pkgs.curl pkgs.jq |
28 | ]} | 36 | ]} |
@@ -79,6 +87,11 @@ let | |||
79 | ''; | 87 | ''; |
80 | toObjects = pkgs.callPackage ./to_objects.nix {}; | 88 | toObjects = pkgs.callPackage ./to_objects.nix {}; |
81 | commonConfig = { | 89 | commonConfig = { |
90 | dilion = { | ||
91 | processWarn = "250"; processAlert = "400"; | ||
92 | loadWarn = "8.0"; loadAlert = "10.0"; | ||
93 | interface = "eth0"; | ||
94 | }; | ||
82 | eldiron = { | 95 | eldiron = { |
83 | processWarn = "250"; processAlert = "400"; | 96 | processWarn = "250"; processAlert = "400"; |
84 | loadWarn = "8.0"; loadAlert = "10.0"; | 97 | loadWarn = "8.0"; loadAlert = "10.0"; |
@@ -95,11 +108,16 @@ let | |||
95 | load15Warn = "1.0"; load15Alert = "2.0"; | 108 | load15Warn = "1.0"; load15Alert = "2.0"; |
96 | interface = "ens3"; | 109 | interface = "ens3"; |
97 | }; | 110 | }; |
111 | quatresaisons = { | ||
112 | processWarn = "250"; processAlert = "400"; | ||
113 | loadWarn = "8.0"; loadAlert = "10.0"; | ||
114 | interface = "eth0"; | ||
115 | }; | ||
98 | }; | 116 | }; |
99 | externalObjects = lib.genAttrs [ "tiboqorl-fr" ] | 117 | externalObjects = lib.genAttrs [ "tiboqorl-fr" ] |
100 | (n: pkgs.callPackage (./. + "/objects_" + n + ".nix") { inherit emailCheck; }); | 118 | (n: pkgs.callPackage (./. + "/objects_" + n + ".nix") { inherit emailCheck; }); |
101 | masterPassiveObjects = let | 119 | masterPassiveObjects = let |
102 | passiveNodes = lib.attrsets.filterAttrs (n: _: builtins.elem n ["backup-2" "eldiron"]) nodes; | 120 | passiveNodes = lib.attrsets.filterAttrs (n: _: builtins.elem n ["backup-2" "eldiron" "quatresaisons" "dilion"]) nodes; |
103 | toPassiveServices = map (s: s.passiveInfo.filter s // s.passiveInfo); | 121 | toPassiveServices = map (s: s.passiveInfo.filter s // s.passiveInfo); |
104 | passiveServices = lib.flatten (lib.attrsets.mapAttrsToList | 122 | passiveServices = lib.flatten (lib.attrsets.mapAttrsToList |
105 | (_: n: toPassiveServices n.config.myServices.monitoring.services) | 123 | (_: n: toPassiveServices n.config.myServices.monitoring.services) |