4efda74bf688f0b2af6d92a0826b53da2c888a2f
Benjamin Renard Add README file

Benjamin Renard authored 9 years ago

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.
Benjamin Renard Improve help message and docs

Benjamin Renard authored 7 years ago

18)     - retreive current xlog file from Postgres master server by making a connection
19)       on master server (UNKNOWN raise on error).
Benjamin Renard Add README file

Benjamin Renard authored 9 years ago

20)     - check if the last receive xlog file is the last replay xlog file (WARNING raise if not)
21)     - Return OK state
22) - if Postgres is not in recovery mode :
23)   - check if Postgres recovery configuration file is present (CRITICAL raise if present)
24)   - check if stand-by client(s) is connected (WARNING raise if not)
25)   - Return OK state with list and count of stand-by client(s)
26) 
Benjamin Renard Improve help message and docs

Benjamin Renard authored 7 years ago

27) Note : This script was originally write for PostgreSQL 9.1 and test on 9.1 and 9.5 but it
28) could be compatible with other versions of PostgreSQL. Do not hesitate to tell me how this
29) script work with other versions and share some fix. All contributions are welcome !
Benjamin Renard Add compatibility note

Benjamin Renard authored 9 years ago

30) 
Benjamin Renard Add README file

Benjamin Renard authored 9 years ago

31) Requirements
32) ------------
33) 
34)  * On master node :
35) 
Benjamin Renard Improve help message and docs

Benjamin Renard authored 7 years ago

36)      Slaves must be able to connect with user from recovery.conf to database with
37)      the same name (or another specify with -D) as trust (or via md5 using password
38)      specify in ~/.pgpass).
Benjamin Renard Add README file

Benjamin Renard authored 9 years ago

39) 
40)  * On standby node :
41) 
Benjamin Renard Improve help message and docs

Benjamin Renard authored 7 years ago

42)      PG_USER must be able to connect localy on the database with the same name
43)      (or another specify with -D) as trust (or via md5 using password specify in
44)      ~/.pgpass).
Benjamin Renard Add README file

Benjamin Renard authored 9 years ago

45) 
46) Usage
47) -----
48) 
49)     Usage : ./check_pg_streaming_replication [-h] [-d] [options]
50) 	-u pg_user		Specify Postgres user (Default : postgres)
51) 	-b psql_bin		Specify psql binary path (Default : /usr/bin/psql)
52) 	-m pg_main		Specify Postgres main directory path
53) 				(Default : /var/lib/postgresql/9.1/main)
54) 	-r recovery_conf	Specify Postgres recovery configuration file path
55) 				(Default : /var/lib/postgresql/9.1/main/recovery.conf)
56) 	-p pg_port		Specify default Postgres master TCP port (Default : 5432)
Benjamin Renard Improve help message and docs

Benjamin Renard authored 7 years ago

57) 	-D dbname		Specify DB name on Postgres hosts to connect on (Default : postgres)
Benjamin Renard Add README file

Benjamin Renard authored 9 years ago

58) 	-d			Debug mode
59) 	-h 			Show this message
60) 
61) Copyright
62) ---------
63) 
Benjamin Renard Improve help message and docs

Benjamin Renard authored 7 years ago

64) Copyright (c) 2017 Benjamin Renard