aboutsummaryrefslogtreecommitdiff
path: root/modules/profile/files/monitoring/check_postgres_replication
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 /modules/profile/files/monitoring/check_postgres_replication
parent2742958fd69c91c442685be62140f1e29e363b95 (diff)
downloadPuppet-a0df248a2be61557b8a67c3d6e4df24dc3e7843e.tar.gz
Puppet-a0df248a2be61557b8a67c3d6e4df24dc3e7843e.tar.zst
Puppet-a0df248a2be61557b8a67c3d6e4df24dc3e7843e.zip
Add monitoring for etherpad
Diffstat (limited to 'modules/profile/files/monitoring/check_postgres_replication')
-rw-r--r--modules/profile/files/monitoring/check_postgres_replication10
1 files changed, 5 insertions, 5 deletions
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