]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Add monitoring for etherpad
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 10 Jul 2018 10:36:52 +0000 (12:36 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 11 Jul 2018 06:02:07 +0000 (08:02 +0200)
modules/base_installation/manifests/package_managers.pp
modules/profile/files/monitoring/check_postgres_replication
modules/profile/manifests/monitoring.pp
modules/profile/manifests/postgresql.pp
modules/profile/manifests/postgresql/master.pp
modules/role/manifests/etherpad.pp

index a03085d512044edae65b764bfca9d330c4f96ffd..f4df1860b1b9c71cf57e9a66634e3a2fb6ad7aea 100644 (file)
@@ -15,15 +15,22 @@ class base_installation::package_managers inherits base_installation {
 
   pacman::repo { 'multilib':
     order   => 15,
-    include => '/etc/pacman.d/mirrorlist'
+    include => '/etc/pacman.d/mirrorlist',
   }
 
   pacman::repo { 'immae':
     order    => 0,
     server   => 'https://git.immae.eu/releases/packages/',
-    siglevel => 'Optional'
+    siglevel => 'Optional',
   }
 
+  exec { "refresh pacman":
+    command     => "/usr/bin/pacman -Sy",
+    refreshonly => true,
+  }
+
+  Concat["/etc/pacman.conf"] ~> Exec["refresh pacman"] -> Package <| name != "pacman" |>
+
   class { 'aur': }
 
   contain "pacman"
index 163c68abc49853401e9974477b89eab462c3788b..a550077dd579e48dae6833f5e1529f2fa4beffbf 100644 (file)
@@ -13,23 +13,23 @@ lag=$(psql -h $host -p $port -A -t -c "SELECT COALESCE(EXTRACT(EPOCH FROM replay
 exit_code=$?
 
 if [[ $exit_code -ne 0 ]]; then
-  echo "UNKNOWN:Impossible to run psql command"
+  echo "UNKNOWN - Impossible to run psql command"
   exit $STATE_UNKNOWN
 elif [[ -z "$lag" ]]; then
-  echo "UNKNOWN:No replication found for $user"
+  echo "UNKNOWN - No replication found for $user"
   exit $STATE_UNKNOWN
 else
   output="Replication lag for $user is ${lag}s"
   LC_ALL=C lag=$(printf "%.*f" 0 $lag)
 
   if [[ $lag -lt 5 ]]; then
-    echo "OK:$output"
+    echo "OK - $output"
     exit $STATE_OK
   elif [[ $lag -lt 10 ]]; then
-    echo "WARNING:$output"
+    echo "WARNING - $output"
     exit $STATE_WARNING
   else
-    echo "CRITICAL:$output"
+    echo "CRITICAL - $output"
     exit $STATE_CRITICAL
   fi
 fi
index beabe70ea22ac881fb77a2818da943177fa9b464..7df4ce944f5109243b00db7b7d0c0521ebbd58f9 100644 (file)
@@ -28,6 +28,13 @@ class profile::monitoring (
     content => template("profile/monitoring/naemon.cfg.erb"),
   }
   ->
+  file { "/etc/naemon/objects.cfg":
+    ensure => "file",
+    owner  => "naemon",
+    group  => "naemon",
+    mode   => "0600"
+  }
+  ->
   service { "naemon":
     ensure => "running",
     enable => true,
index edd6ea64d0e9c461d08e24add62e4c908393f7fc..fedbcb1ef7574f5675690a3b83bf25d01177873d 100644 (file)
@@ -30,7 +30,7 @@ class profile::postgresql (
 
   @profile::monitoring::local_service { "Databases are present in postgresql":
     sudos => {
-      "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\ nspname\ from\ pg_catalog.pg_namespace"
+      "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\\ nspname\\ from\\ pg_catalog.pg_namespace"
     },
     local => {
       check_command => "check_command_output!psql -c 'select nspname from pg_catalog.pg_namespace'!public!-r postgres",
index e775eb439b3c0bcf4bff79ec318a25448e8ca5a4..99ac4c45fe3fc7cefa1e8ad8bbf31cffed0b482c 100644 (file)
@@ -66,7 +66,7 @@ define profile::postgresql::master (
 
       },
       local => {
-        check_command => "check_postgresql_replication!$backup_host!/run/postgresql/!5432",
+        check_command => "check_postgresql_replication!$backup_host!/run/postgresql!5432",
       }
     }
   }
index 5ab5023124a28805980a03d5c72c08273db0054c..1a86389ee48d0ec993ae85905884b5f13512672e 100644 (file)
@@ -22,6 +22,7 @@ class role::etherpad (
   include "profile::tools"
   include "profile::postgresql"
   include "profile::apache"
+  include "profile::monitoring"
 
   ensure_packages(["npm"])
   ensure_packages(["abiword"])