X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=flakes%2Fprivate%2Fmonitoring%2Fmyplugins.nix;h=bb3a383c05ff8fd812c8f9e277a68ce0366994ec;hb=HEAD;hp=f76f2c1a4dfe93dbe79a5978d09d2331758a3280;hpb=97787a9dd8b136c8dc327fab42aedf2aa1109ec0;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/flakes/private/monitoring/myplugins.nix b/flakes/private/monitoring/myplugins.nix index f76f2c1..bb3a383 100644 --- a/flakes/private/monitoring/myplugins.nix +++ b/flakes/private/monitoring/myplugins.nix @@ -284,6 +284,30 @@ in ]} ''; }; + smartctl = { + commands = { + check_smartctl = "$USER2$/check_smartctl -i auto -d $ARG1$"; + }; + chunk = let + smartPlugin = pkgs.fetchurl { + url = "https://www.claudiokuenzler.com/monitoring-plugins/check_smart.pl"; + sha256 = "sha256-gxGkzyycUl+I3WziKhOnZSoQjpqbPqjbunfUQxmeb7w="; + }; + in '' + cp ${smartPlugin} $out/check_smartctl + chmod +x $out/check_smartctl + patchShebangs $out + substituteInPlace $out/check_smartctl --replace "/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin" "${pkgs.smartmontools}/bin" + substituteInPlace $out/check_smartctl --replace "sudo" "${sudo}" + ''; + + sudo = _: { + commands = [ + { command = "${pkgs.smartmontools}/bin/smartctl *"; options = [ "NOPASSWD" ]; } + ]; + runAs = "root"; + }; + }; mysql = { commands = { check_mysql_replication = "${sudo} -u mysql $USER2$/check_mysql_replication \"$ARG1$\" \"$ARG2$\"";