aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-10 12:36:52 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-11 08:02:07 +0200
commita0df248a2be61557b8a67c3d6e4df24dc3e7843e (patch)
treea65e84c5bce103ba54f74dd4930713b66cf466cc
parent2742958fd69c91c442685be62140f1e29e363b95 (diff)
downloadPuppet-a0df248a2be61557b8a67c3d6e4df24dc3e7843e.tar.gz
Puppet-a0df248a2be61557b8a67c3d6e4df24dc3e7843e.tar.zst
Puppet-a0df248a2be61557b8a67c3d6e4df24dc3e7843e.zip
Add monitoring for etherpad
-rw-r--r--modules/base_installation/manifests/package_managers.pp11
-rw-r--r--modules/profile/files/monitoring/check_postgres_replication10
-rw-r--r--modules/profile/manifests/monitoring.pp7
-rw-r--r--modules/profile/manifests/postgresql.pp2
-rw-r--r--modules/profile/manifests/postgresql/master.pp2
-rw-r--r--modules/role/manifests/etherpad.pp1
6 files changed, 24 insertions, 9 deletions
diff --git a/modules/base_installation/manifests/package_managers.pp b/modules/base_installation/manifests/package_managers.pp
index a03085d..f4df186 100644
--- a/modules/base_installation/manifests/package_managers.pp
+++ b/modules/base_installation/manifests/package_managers.pp
@@ -15,15 +15,22 @@ class base_installation::package_managers inherits base_installation {
15 15
16 pacman::repo { 'multilib': 16 pacman::repo { 'multilib':
17 order => 15, 17 order => 15,
18 include => '/etc/pacman.d/mirrorlist' 18 include => '/etc/pacman.d/mirrorlist',
19 } 19 }
20 20
21 pacman::repo { 'immae': 21 pacman::repo { 'immae':
22 order => 0, 22 order => 0,
23 server => 'https://git.immae.eu/releases/packages/', 23 server => 'https://git.immae.eu/releases/packages/',
24 siglevel => 'Optional' 24 siglevel => 'Optional',
25 } 25 }
26 26
27 exec { "refresh pacman":
28 command => "/usr/bin/pacman -Sy",
29 refreshonly => true,
30 }
31
32 Concat["/etc/pacman.conf"] ~> Exec["refresh pacman"] -> Package <| name != "pacman" |>
33
27 class { 'aur': } 34 class { 'aur': }
28 35
29 contain "pacman" 36 contain "pacman"
diff --git a/modules/profile/files/monitoring/check_postgres_replication b/modules/profile/files/monitoring/check_postgres_replication
index 163c68a..a550077 100644
--- a/modules/profile/files/monitoring/check_postgres_replication
+++ b/modules/profile/files/monitoring/check_postgres_replication
@@ -13,23 +13,23 @@ lag=$(psql -h $host -p $port -A -t -c "SELECT COALESCE(EXTRACT(EPOCH FROM replay
13exit_code=$? 13exit_code=$?
14 14
15if [[ $exit_code -ne 0 ]]; then 15if [[ $exit_code -ne 0 ]]; then
16 echo "UNKNOWN:Impossible to run psql command" 16 echo "UNKNOWN - Impossible to run psql command"
17 exit $STATE_UNKNOWN 17 exit $STATE_UNKNOWN
18elif [[ -z "$lag" ]]; then 18elif [[ -z "$lag" ]]; then
19 echo "UNKNOWN:No replication found for $user" 19 echo "UNKNOWN - No replication found for $user"
20 exit $STATE_UNKNOWN 20 exit $STATE_UNKNOWN
21else 21else
22 output="Replication lag for $user is ${lag}s" 22 output="Replication lag for $user is ${lag}s"
23 LC_ALL=C lag=$(printf "%.*f" 0 $lag) 23 LC_ALL=C lag=$(printf "%.*f" 0 $lag)
24 24
25 if [[ $lag -lt 5 ]]; then 25 if [[ $lag -lt 5 ]]; then
26 echo "OK:$output" 26 echo "OK - $output"
27 exit $STATE_OK 27 exit $STATE_OK
28 elif [[ $lag -lt 10 ]]; then 28 elif [[ $lag -lt 10 ]]; then
29 echo "WARNING:$output" 29 echo "WARNING - $output"
30 exit $STATE_WARNING 30 exit $STATE_WARNING
31 else 31 else
32 echo "CRITICAL:$output" 32 echo "CRITICAL - $output"
33 exit $STATE_CRITICAL 33 exit $STATE_CRITICAL
34 fi 34 fi
35fi 35fi
diff --git a/modules/profile/manifests/monitoring.pp b/modules/profile/manifests/monitoring.pp
index beabe70..7df4ce9 100644
--- a/modules/profile/manifests/monitoring.pp
+++ b/modules/profile/manifests/monitoring.pp
@@ -28,6 +28,13 @@ class profile::monitoring (
28 content => template("profile/monitoring/naemon.cfg.erb"), 28 content => template("profile/monitoring/naemon.cfg.erb"),
29 } 29 }
30 -> 30 ->
31 file { "/etc/naemon/objects.cfg":
32 ensure => "file",
33 owner => "naemon",
34 group => "naemon",
35 mode => "0600"
36 }
37 ->
31 service { "naemon": 38 service { "naemon":
32 ensure => "running", 39 ensure => "running",
33 enable => true, 40 enable => true,
diff --git a/modules/profile/manifests/postgresql.pp b/modules/profile/manifests/postgresql.pp
index edd6ea6..fedbcb1 100644
--- a/modules/profile/manifests/postgresql.pp
+++ b/modules/profile/manifests/postgresql.pp
@@ -30,7 +30,7 @@ class profile::postgresql (
30 30
31 @profile::monitoring::local_service { "Databases are present in postgresql": 31 @profile::monitoring::local_service { "Databases are present in postgresql":
32 sudos => { 32 sudos => {
33 "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\ nspname\ from\ pg_catalog.pg_namespace" 33 "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\\ nspname\\ from\\ pg_catalog.pg_namespace"
34 }, 34 },
35 local => { 35 local => {
36 check_command => "check_command_output!psql -c 'select nspname from pg_catalog.pg_namespace'!public!-r postgres", 36 check_command => "check_command_output!psql -c 'select nspname from pg_catalog.pg_namespace'!public!-r postgres",
diff --git a/modules/profile/manifests/postgresql/master.pp b/modules/profile/manifests/postgresql/master.pp
index e775eb4..99ac4c4 100644
--- a/modules/profile/manifests/postgresql/master.pp
+++ b/modules/profile/manifests/postgresql/master.pp
@@ -66,7 +66,7 @@ define profile::postgresql::master (
66 66
67 }, 67 },
68 local => { 68 local => {
69 check_command => "check_postgresql_replication!$backup_host!/run/postgresql/!5432", 69 check_command => "check_postgresql_replication!$backup_host!/run/postgresql!5432",
70 } 70 }
71 } 71 }
72 } 72 }
diff --git a/modules/role/manifests/etherpad.pp b/modules/role/manifests/etherpad.pp
index 5ab5023..1a86389 100644
--- a/modules/role/manifests/etherpad.pp
+++ b/modules/role/manifests/etherpad.pp
@@ -22,6 +22,7 @@ class role::etherpad (
22 include "profile::tools" 22 include "profile::tools"
23 include "profile::postgresql" 23 include "profile::postgresql"
24 include "profile::apache" 24 include "profile::apache"
25 include "profile::monitoring"
25 26
26 ensure_packages(["npm"]) 27 ensure_packages(["npm"])
27 ensure_packages(["abiword"]) 28 ensure_packages(["abiword"])