diff options
Diffstat (limited to 'modules/private/monitoring/default.nix')
-rw-r--r-- | modules/private/monitoring/default.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/private/monitoring/default.nix b/modules/private/monitoring/default.nix index 73e4275..342c7f7 100644 --- a/modules/private/monitoring/default.nix +++ b/modules/private/monitoring/default.nix | |||
@@ -20,11 +20,28 @@ let | |||
20 | url = "https://www.claudiokuenzler.com/monitoring-plugins/check_zpools.sh"; | 20 | url = "https://www.claudiokuenzler.com/monitoring-plugins/check_zpools.sh"; |
21 | sha256 = "0p9ms9340in80jkds4kfspw62xnzsv5s7ni9m28kxyd0bnzkbzhf"; | 21 | sha256 = "0p9ms9340in80jkds4kfspw62xnzsv5s7ni9m28kxyd0bnzkbzhf"; |
22 | }; | 22 | }; |
23 | megacli = pkgs.megacli.overrideAttrs(old: { meta = old.meta // { license = null; }; }); | ||
24 | megaCliPlugin = pkgs.runCommand "megaCliPlugin" { | ||
25 | plugin = pkgs.fetchurl { | ||
26 | name = "check_megaraid_sas"; | ||
27 | url = "https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=6381&cf_id=24"; | ||
28 | sha256 = "0yf60p4c0hb4q3fng9fc14qc89bqm0f1sijayzygadaqcl44jx4p"; | ||
29 | }; | ||
30 | } '' | ||
31 | mkdir $out | ||
32 | cp $plugin $out/check_megaraid_sas | ||
33 | chmod +x $out/check_megaraid_sas | ||
34 | patchShebangs $out | ||
35 | substituteInPlace $out/check_megaraid_sas --replace /usr/sbin/MegaCli ${megacli}/bin/MegaCli64 | ||
36 | substituteInPlace $out/check_megaraid_sas --replace 'sudo $megacli' '/run/wrappers/bin/sudo $megacli' | ||
37 | sed -i -e "s/use utils qw(%ERRORS);/my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3);/" $out/check_megaraid_sas | ||
38 | ''; | ||
23 | myplugins = pkgs.runCommand "buildplugins" { | 39 | myplugins = pkgs.runCommand "buildplugins" { |
24 | buildInputs = [ pkgs.makeWrapper pkgs.perl ]; | 40 | buildInputs = [ pkgs.makeWrapper pkgs.perl ]; |
25 | } '' | 41 | } '' |
26 | mkdir $out | 42 | mkdir $out |
27 | cp ${zfsPlugin} $out/check_zpool.sh && chmod +x $out/check_zpool.sh | 43 | cp ${zfsPlugin} $out/check_zpool.sh && chmod +x $out/check_zpool.sh |
44 | cp ${megaCliPlugin}/check_megaraid_sas $out/ | ||
28 | cp ${./plugins}/* $out/ | 45 | cp ${./plugins}/* $out/ |
29 | patchShebangs $out | 46 | patchShebangs $out |
30 | wrapProgram $out/check_command --prefix PATH : ${config.security.wrapperDir} | 47 | wrapProgram $out/check_command --prefix PATH : ${config.security.wrapperDir} |
@@ -226,6 +243,7 @@ in | |||
226 | commands = [ | 243 | commands = [ |
227 | { command = "${pkgs.mdadm}/bin/mdadm --monitor --scan -1"; options = [ "NOPASSWD" ]; } | 244 | { command = "${pkgs.mdadm}/bin/mdadm --monitor --scan -1"; options = [ "NOPASSWD" ]; } |
228 | { command = "${pkgs.postfix}/bin/mailq"; options = [ "NOPASSWD" ]; } | 245 | { command = "${pkgs.postfix}/bin/mailq"; options = [ "NOPASSWD" ]; } |
246 | { command = "${megacli}/bin/MegaCli64"; options = [ "NOPASSWD" ]; } | ||
229 | ]; | 247 | ]; |
230 | users = [ "naemon" ]; | 248 | users = [ "naemon" ]; |
231 | runAs = "root"; | 249 | runAs = "root"; |