]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Add monitoring for backup
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 10 Jul 2018 08:45:04 +0000 (10:45 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 11 Jul 2018 06:02:15 +0000 (08:02 +0200)
modules/profile/manifests/fstab.pp
modules/profile/manifests/monitoring/local_service.pp
modules/profile/manifests/postgresql/backup_dump.pp
modules/role/manifests/backup.pp

index 8ecfe723dc016685464d3db6a4d321bb7f26016a..3af316e2808bf23afeac853ae2f69d44d1089120 100644 (file)
@@ -15,6 +15,12 @@ class profile::fstab (
         device => "UUID=${infos[1]}",
         fstype => $infos[2]
       }
+
+      @profile::monitoring::local_service { "Size on ${infos[0]} partition":
+        local => {
+          check_command => "check_local_disk!10%!5%!${infos[0]}",
+        };
+      }
     }
   }
 }
index 0caf72ee941475ce2424559246bc4bc2eb4645eb..9af7c7af2b600e711d231de88ec49239664566c4 100644 (file)
@@ -46,10 +46,10 @@ define profile::monitoring::local_service (
     })
 
   $sudos.each |$sudo_name, $content| {
-    sudo::conf { $sudo_name:
-      content        => $content,
-      before         => Nagios_service[$service_description],
-    }
+    ensure_resource("sudo::conf", $sudo_name, {
+      content => $content,
+      before  => Nagios_service[$service_description],
+    })
   }
 
   [true, false].each |$services_for_master| {
index 5e469c5c213c893afef1fb8cd1164c26155e080e..5f456ed37060bd4393caf7dd05aabe813623e66f 100644 (file)
@@ -60,10 +60,10 @@ define profile::postgresql::backup_dump (
 
   @profile::monitoring::local_service { "Last postgresql dump in $pg_backup_path is not too old":
     sudos => {
-      "naemon-postgresql-dumps" => "naemon  ALL=($pg_user) NOPASSWD: /usr/bin/find $pg_backup_path -mindepth 1 -maxdepth 1 -printf %T@\\n",
-    }
+      "naemon-postgresql-dumps-$pg_host" => "naemon  ALL=($pg_user) NOPASSWD: /usr/bin/find $pg_backup_path -mindepth 1 -maxdepth 1 -printf %T@?n",
+    },
     local => {
-      check_command => "check_last_file_date!$pg_backup_path!10!$pg_user"
+      check_command => "check_last_file_date!$pg_backup_path!10!$pg_user",
     }
   }
 }
index b35c54270fbe2f573700ab782840fe10e32653b0..c0672c6c036b6032dae1471606853ca6f24e2a89 100644 (file)
@@ -14,6 +14,7 @@ class role::backup (
   include "profile::xmr_stak"
   include "profile::known_hosts"
   include "profile::boinc"
+  include "profile::monitoring"
 
   include "role::backup::postgresql"