Add README file
Benjamin Renard

Benjamin Renard commited on 2015-04-27 14:24:36
Showing 1 changed files, with 70 additions and 0 deletions.

... ...
@@ -0,0 +1,70 @@
1
+Nagios plugin to check Postgres Streaming replication
2
+=====================================================
3
+
4
+This script could be used as Nagios check plugin to verify Postgres Streaming
5
+replication state.
6
+
7
+This script :
8
+
9
+- check if Postgres is running (CRITICAL raise if not)
10
+- check if Postgres is in recovery mode :
11
+  - if Postgres is in recovery mode :
12
+    - retreive from Postgres the last xlog file receive and the xlog file replay
13
+    - check if Postgres recovery configuration file is NOT present (CRITICAL
14
+      raise if present)
15
+    - retreive master connection informations from Postgres recovery configuration
16
+      file (UNKNOWN raise on error). Default Postgres master TCP port will be used
17
+      if port is not specify.
18
+    - retreive  current xlog file from Postgres master server (UNKNOWN raise on error).
19
+    - check if the last receive xlog file is the last replay xlog file (WARNING raise if not)
20
+    - Return OK state
21
+- if Postgres is not in recovery mode :
22
+  - check if Postgres recovery configuration file is present (CRITICAL raise if present)
23
+  - check if stand-by client(s) is connected (WARNING raise if not)
24
+  - Return OK state with list and count of stand-by client(s)
25
+
26
+Requirements
27
+------------
28
+
29
+ * On master node :
30
+
31
+     Slaves node must be able to connect with user PG_USER to database postgres as trust.
32
+
33
+ * On standby node :
34
+
35
+     PG_USER must be able to connect localy as trust
36
+
37
+Usage
38
+-----
39
+
40
+    Usage : ./check_pg_streaming_replication [-h] [-d] [options]
41
+	-u pg_user		Specify Postgres user (Default : postgres)
42
+	-b psql_bin		Specify psql binary path (Default : /usr/bin/psql)
43
+	-m pg_main		Specify Postgres main directory path
44
+				(Default : /var/lib/postgresql/9.1/main)
45
+	-r recovery_conf	Specify Postgres recovery configuration file path
46
+				(Default : /var/lib/postgresql/9.1/main/recovery.conf)
47
+	-p pg_port		Specify default Postgres master TCP port (Default : 5432)
48
+	-d			Debug mode
49
+	-h 			Show this message
50
+
51
+Copyright
52
+---------
53
+
54
+Copyright (c) 2013 Benjamin Renard 
55
+
56
+License
57
+-------
58
+
59
+This program is free software; you can redistribute it and/or
60
+modify it under the terms of the GNU General Public License version 2
61
+as published by the Free Software Foundation.
62
+
63
+This program is distributed in the hope that it will be useful,
64
+but WITHOUT ANY WARRANTY; without even the implied warranty of
65
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
66
+GNU General Public License for more details.
67
+
68
+You should have received a copy of the GNU General Public License
69
+along with this program; if not, write to the Free Software
70
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0 71