diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2024-04-13 12:39:31 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2024-04-13 12:44:20 +0200 |
commit | 408ce9363bf574796487fedfe59a4a2ff0cbb4cb (patch) | |
tree | 6085dd71a94e760d665be2a721a53302350c8e11 /flakes | |
parent | d1527470d38cfbd439c4da83c73ef68b02e9de9a (diff) | |
download | Nix-408ce9363bf574796487fedfe59a4a2ff0cbb4cb.tar.gz Nix-408ce9363bf574796487fedfe59a4a2ff0cbb4cb.tar.zst Nix-408ce9363bf574796487fedfe59a4a2ff0cbb4cb.zip |
Add monitoring script with smartctl
Diffstat (limited to 'flakes')
-rw-r--r-- | flakes/flake.lock | 22 | ||||
-rw-r--r-- | flakes/private/monitoring/myplugins.nix | 24 |
2 files changed, 35 insertions, 11 deletions
diff --git a/flakes/flake.lock b/flakes/flake.lock index 17264a4..85690fa 100644 --- a/flakes/flake.lock +++ b/flakes/flake.lock | |||
@@ -2815,7 +2815,7 @@ | |||
2815 | }, | 2815 | }, |
2816 | "locked": { | 2816 | "locked": { |
2817 | "lastModified": 1, | 2817 | "lastModified": 1, |
2818 | "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", | 2818 | "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", |
2819 | "path": "../../flakes/private/monitoring", | 2819 | "path": "../../flakes/private/monitoring", |
2820 | "type": "path" | 2820 | "type": "path" |
2821 | }, | 2821 | }, |
@@ -2833,7 +2833,7 @@ | |||
2833 | }, | 2833 | }, |
2834 | "locked": { | 2834 | "locked": { |
2835 | "lastModified": 1, | 2835 | "lastModified": 1, |
2836 | "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", | 2836 | "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", |
2837 | "path": "../../flakes/private/monitoring", | 2837 | "path": "../../flakes/private/monitoring", |
2838 | "type": "path" | 2838 | "type": "path" |
2839 | }, | 2839 | }, |
@@ -2851,7 +2851,7 @@ | |||
2851 | }, | 2851 | }, |
2852 | "locked": { | 2852 | "locked": { |
2853 | "lastModified": 1, | 2853 | "lastModified": 1, |
2854 | "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", | 2854 | "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", |
2855 | "path": "../../flakes/private/monitoring", | 2855 | "path": "../../flakes/private/monitoring", |
2856 | "type": "path" | 2856 | "type": "path" |
2857 | }, | 2857 | }, |
@@ -2869,7 +2869,7 @@ | |||
2869 | }, | 2869 | }, |
2870 | "locked": { | 2870 | "locked": { |
2871 | "lastModified": 1, | 2871 | "lastModified": 1, |
2872 | "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", | 2872 | "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", |
2873 | "path": "../../flakes/private/monitoring", | 2873 | "path": "../../flakes/private/monitoring", |
2874 | "type": "path" | 2874 | "type": "path" |
2875 | }, | 2875 | }, |
@@ -3753,7 +3753,7 @@ | |||
3753 | }, | 3753 | }, |
3754 | "locked": { | 3754 | "locked": { |
3755 | "lastModified": 1, | 3755 | "lastModified": 1, |
3756 | "narHash": "sha256-B2JdIp5q/8/LurN4lXB17C1+mpEKeqPzObmNOObO5rQ=", | 3756 | "narHash": "sha256-KL5aC6l/mM+ucHadjCtlSY6iBZ9/VKRf2Rgw2tjwfqo=", |
3757 | "path": "../systems/backup-2", | 3757 | "path": "../systems/backup-2", |
3758 | "type": "path" | 3758 | "type": "path" |
3759 | }, | 3759 | }, |
@@ -3776,7 +3776,7 @@ | |||
3776 | }, | 3776 | }, |
3777 | "locked": { | 3777 | "locked": { |
3778 | "lastModified": 1, | 3778 | "lastModified": 1, |
3779 | "narHash": "sha256-dWAbGxB91utxwTlxsJZdp2OSaIAo8y5LXjdTCFMRn+4=", | 3779 | "narHash": "sha256-VliQ62boc8jNgPCBX6JjVS/pA6YoikZVkvE1xxHAITk=", |
3780 | "path": "../systems/dilion", | 3780 | "path": "../systems/dilion", |
3781 | "type": "path" | 3781 | "type": "path" |
3782 | }, | 3782 | }, |
@@ -3824,7 +3824,7 @@ | |||
3824 | }, | 3824 | }, |
3825 | "locked": { | 3825 | "locked": { |
3826 | "lastModified": 1, | 3826 | "lastModified": 1, |
3827 | "narHash": "sha256-OvT4dJGxdFBUgwjTu6FzejI/euWYXWsX1vD952B8934=", | 3827 | "narHash": "sha256-YVJi4KPT8rsGNzZshYfUyz9l27QGAEsb8Iyu3O0/bMA=", |
3828 | "path": "../systems/eldiron", | 3828 | "path": "../systems/eldiron", |
3829 | "type": "path" | 3829 | "type": "path" |
3830 | }, | 3830 | }, |
@@ -3850,7 +3850,7 @@ | |||
3850 | }, | 3850 | }, |
3851 | "locked": { | 3851 | "locked": { |
3852 | "lastModified": 1, | 3852 | "lastModified": 1, |
3853 | "narHash": "sha256-6hqQjoy1lyIJziqe0AJ62aq62soi5D14NKOzNEY3SsQ=", | 3853 | "narHash": "sha256-HiDwzScPHp084MwtWET+17WbrWf3zs9qJzv/EqNaSqM=", |
3854 | "path": "../systems/monitoring-1", | 3854 | "path": "../systems/monitoring-1", |
3855 | "type": "path" | 3855 | "type": "path" |
3856 | }, | 3856 | }, |
@@ -3875,7 +3875,7 @@ | |||
3875 | }, | 3875 | }, |
3876 | "locked": { | 3876 | "locked": { |
3877 | "lastModified": 1, | 3877 | "lastModified": 1, |
3878 | "narHash": "sha256-yBuAfW59X0e840QBFtQrefG3T/IQIQSXiZ4WU2/+gBI=", | 3878 | "narHash": "sha256-YWEuXALLICHE+WsMtMuiCm6b2IRQyJrFpfMgH6ZLD0A=", |
3879 | "path": "../systems/quatresaisons", | 3879 | "path": "../systems/quatresaisons", |
3880 | "type": "path" | 3880 | "type": "path" |
3881 | }, | 3881 | }, |
@@ -7384,7 +7384,7 @@ | |||
7384 | }, | 7384 | }, |
7385 | "locked": { | 7385 | "locked": { |
7386 | "lastModified": 1, | 7386 | "lastModified": 1, |
7387 | "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", | 7387 | "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", |
7388 | "path": "../../flakes/private/monitoring", | 7388 | "path": "../../flakes/private/monitoring", |
7389 | "type": "path" | 7389 | "type": "path" |
7390 | }, | 7390 | }, |
@@ -8294,7 +8294,7 @@ | |||
8294 | }, | 8294 | }, |
8295 | "locked": { | 8295 | "locked": { |
8296 | "lastModified": 1, | 8296 | "lastModified": 1, |
8297 | "narHash": "sha256-PicwNqwQaCKtN5zPpTfpSDRXbyn9xh8aHqoPnm9cFz8=", | 8297 | "narHash": "sha256-A50vXg0qfzUhyQZKToEseYsLgtaYke41KE/4uuyj+PY=", |
8298 | "path": "./private/monitoring", | 8298 | "path": "./private/monitoring", |
8299 | "type": "path" | 8299 | "type": "path" |
8300 | }, | 8300 | }, |
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 | |||
284 | ]} | 284 | ]} |
285 | ''; | 285 | ''; |
286 | }; | 286 | }; |
287 | smartctl = { | ||
288 | commands = { | ||
289 | check_smartctl = "$USER2$/check_smartctl -i auto -d $ARG1$"; | ||
290 | }; | ||
291 | chunk = let | ||
292 | smartPlugin = pkgs.fetchurl { | ||
293 | url = "https://www.claudiokuenzler.com/monitoring-plugins/check_smart.pl"; | ||
294 | sha256 = "sha256-gxGkzyycUl+I3WziKhOnZSoQjpqbPqjbunfUQxmeb7w="; | ||
295 | }; | ||
296 | in '' | ||
297 | cp ${smartPlugin} $out/check_smartctl | ||
298 | chmod +x $out/check_smartctl | ||
299 | patchShebangs $out | ||
300 | substituteInPlace $out/check_smartctl --replace "/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin" "${pkgs.smartmontools}/bin" | ||
301 | substituteInPlace $out/check_smartctl --replace "sudo" "${sudo}" | ||
302 | ''; | ||
303 | |||
304 | sudo = _: { | ||
305 | commands = [ | ||
306 | { command = "${pkgs.smartmontools}/bin/smartctl *"; options = [ "NOPASSWD" ]; } | ||
307 | ]; | ||
308 | runAs = "root"; | ||
309 | }; | ||
310 | }; | ||
287 | mysql = { | 311 | mysql = { |
288 | commands = { | 312 | commands = { |
289 | check_mysql_replication = "${sudo} -u mysql $USER2$/check_mysql_replication \"$ARG1$\" \"$ARG2$\""; | 313 | check_mysql_replication = "${sudo} -u mysql $USER2$/check_mysql_replication \"$ARG1$\" \"$ARG2$\""; |