diff options
Diffstat (limited to 'flakes/private/monitoring/myplugins.nix')
-rw-r--r-- | flakes/private/monitoring/myplugins.nix | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/flakes/private/monitoring/myplugins.nix b/flakes/private/monitoring/myplugins.nix index eb2fbd1..ca47b71 100644 --- a/flakes/private/monitoring/myplugins.nix +++ b/flakes/private/monitoring/myplugins.nix | |||
@@ -248,20 +248,19 @@ in | |||
248 | }; | 248 | }; |
249 | megaraid = let | 249 | megaraid = let |
250 | megacli = pkgs.megacli.overrideAttrs(old: { meta = old.meta // { license = null; }; }); | 250 | megacli = pkgs.megacli.overrideAttrs(old: { meta = old.meta // { license = null; }; }); |
251 | rawPlugin = pkgs.fetchurl { | ||
252 | name = "check_megaraid_sas"; | ||
253 | url = "https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=6381&cf_id=24"; | ||
254 | sha256 = "0yf60p4c0hb4q3fng9fc14qc89bqm0f1sijayzygadaqcl44jx4p"; | ||
255 | }; | ||
251 | in { | 256 | in { |
252 | commands = { | 257 | commands = { |
253 | check_megaraid = "$USER2$/check_megaraid_sas --sudo"; | 258 | check_megaraid = "$USER2$/check_megaraid_sas --sudo"; |
254 | }; | 259 | }; |
255 | chunk = let | 260 | chunk = let |
256 | megaCliPlugin = pkgs.runCommand "megaCliPlugin" { | 261 | megaCliPlugin = pkgs.runCommand "megaCliPlugin" {} '' |
257 | plugin = pkgs.fetchurl { | ||
258 | name = "check_megaraid_sas"; | ||
259 | url = "https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=6381&cf_id=24"; | ||
260 | sha256 = "0yf60p4c0hb4q3fng9fc14qc89bqm0f1sijayzygadaqcl44jx4p"; | ||
261 | }; | ||
262 | } '' | ||
263 | mkdir $out | 262 | mkdir $out |
264 | cp $plugin $out/check_megaraid_sas | 263 | cp ${rawPlugin} $out/check_megaraid_sas |
265 | chmod +x $out/check_megaraid_sas | 264 | chmod +x $out/check_megaraid_sas |
266 | patchShebangs $out | 265 | patchShebangs $out |
267 | substituteInPlace $out/check_megaraid_sas --replace /usr/sbin/MegaCli ${megacli}/bin/MegaCli64 | 266 | substituteInPlace $out/check_megaraid_sas --replace /usr/sbin/MegaCli ${megacli}/bin/MegaCli64 |
@@ -278,6 +277,13 @@ in | |||
278 | ]; | 277 | ]; |
279 | runAs = "root"; | 278 | runAs = "root"; |
280 | }; | 279 | }; |
280 | debianScript = "${pkgs.runCommand "megacli-plugin" {} '' | ||
281 | mkdir $out | ||
282 | cp ${rawPlugin} $out/check_megaraid_sas | ||
283 | chmod +wx $out/check_megaraid_sas | ||
284 | sed -i -e 's@/usr/sbin/MegaCli@/usr/sbin/megacli@' $out/check_megaraid_sas | ||
285 | ''}/check_megaraid_sas"; | ||
286 | debianPackages = [ "perl" ]; | ||
281 | }; | 287 | }; |
282 | memory = { | 288 | memory = { |
283 | commands = { | 289 | commands = { |
@@ -293,16 +299,16 @@ in | |||
293 | debianScript = "${./plugins}/check_mem.sh"; | 299 | debianScript = "${./plugins}/check_mem.sh"; |
294 | debianPackages = [ "grep" "mawk" "procps" ]; | 300 | debianPackages = [ "grep" "mawk" "procps" ]; |
295 | }; | 301 | }; |
296 | smartctl = { | 302 | smartctl = let |
303 | smartPlugin = pkgs.fetchurl { | ||
304 | url = "https://www.claudiokuenzler.com/monitoring-plugins/check_smart.pl"; | ||
305 | sha256 = "sha256-gxGkzyycUl+I3WziKhOnZSoQjpqbPqjbunfUQxmeb7w="; | ||
306 | }; | ||
307 | in { | ||
297 | commands = { | 308 | commands = { |
298 | check_smartctl = "$USER2$/check_smartctl -i auto -d $ARG1$"; | 309 | check_smartctl = "$USER2$/check_smartctl -s -i auto -d $ARG1$"; |
299 | }; | 310 | }; |
300 | chunk = let | 311 | chunk = '' |
301 | smartPlugin = pkgs.fetchurl { | ||
302 | url = "https://www.claudiokuenzler.com/monitoring-plugins/check_smart.pl"; | ||
303 | sha256 = "sha256-gxGkzyycUl+I3WziKhOnZSoQjpqbPqjbunfUQxmeb7w="; | ||
304 | }; | ||
305 | in '' | ||
306 | cp ${smartPlugin} $out/check_smartctl | 312 | cp ${smartPlugin} $out/check_smartctl |
307 | chmod +x $out/check_smartctl | 313 | chmod +x $out/check_smartctl |
308 | patchShebangs $out | 314 | patchShebangs $out |
@@ -316,6 +322,12 @@ in | |||
316 | ]; | 322 | ]; |
317 | runAs = "root"; | 323 | runAs = "root"; |
318 | }; | 324 | }; |
325 | debianScript = "${pkgs.runCommand "smart-plugin" {} '' | ||
326 | mkdir $out | ||
327 | cp ${smartPlugin} $out/check_smart.pl | ||
328 | chmod +x $out/check_smart.pl | ||
329 | ''}/check_smart.pl"; | ||
330 | debianPackages = [ "perl" ]; | ||
319 | }; | 331 | }; |
320 | mysql = { | 332 | mysql = { |
321 | commands = { | 333 | commands = { |