Update README file and script header note
This commit is contained in:
parent
49648b04fc
commit
8b03a8bc21
2 changed files with 34 additions and 28 deletions
42
README.md
42
README.md
|
@ -1,5 +1,4 @@
|
|||
Nagios plugin to check Postgres Streaming replication
|
||||
=====================================================
|
||||
# Nagios plugin to check Postgres Streaming replication
|
||||
|
||||
This script could be used as Nagios check plugin to verify Postgres Streaming replication state.
|
||||
|
||||
|
@ -13,7 +12,7 @@ This script :
|
|||
- retreive master connection informations from Postgres recovery configuration file (_UNKNOWN_ raise on error). Default Postgres master TCP port will be used if port is not specify.
|
||||
- retreive the current state and sync state of the host from Postgres master server by making a connection on master server (_UNKNOWN_ raise on error).
|
||||
- check if the current state of the host is "streaming" (_CRITICAL_ raise if not)
|
||||
- check if the current sync state of the host is "sync" (_CRITICAL_ raise if not)
|
||||
- check if the current sync state of the host is "sync" (or the state specified using `-e` parameter, _CRITICAL_ raise if not)
|
||||
- if the check of the current XLOG file of the master host is enabled :
|
||||
- retreive current _xlog_ file from Postgres master server by making a connection on master server (_UNKNOWN_ raise on error).
|
||||
- check if the current master _xlog_ file is the last received _xlog_ file (_CRITICAL_ raise if not)
|
||||
|
@ -24,22 +23,31 @@ This script :
|
|||
- check if stand-by client(s) is connected (_WARNING_ raise if not)
|
||||
- Return _OK_ state with list and count of stand-by client(s)
|
||||
|
||||
**Note :** This script was originally write for PostgreSQL 9.1 and test on 9.1, 9.5 and 9.6 but it could be compatible with other versions of PostgreSQL. Some adjustments have been made for PostgreSQL >= 10 (without testing it). Do not hesitate to tell me how this script work with other versions and share some fix. All contributions are welcome !
|
||||
**Note :** This script was originally write for PostgreSQL 9.1 and test on 9.1, 9.5, 9.6, 11, 13 and 15. Do not hesitate to tell me how this script work with other versions and share some fix. All contributions are welcome !
|
||||
|
||||
Requirements
|
||||
------------
|
||||
## Requirements
|
||||
|
||||
* Some CLI tools: `sudo`, `awk`, `sed`, `bc`, `psql` and `pg_lscluster`
|
||||
|
||||
* **On master node:** Slaves must be able to connect with user from `recovery.conf` (or user specify using `-U`) to database with the same name (or another specified with `-D`) as `trust` (or via `md5` using password specified in `~/.pgpass`). This user must have `SUPERUSER` privilege (need to get replication details).
|
||||
* **On master node:** Slaves must be able to connect with user from `recovery.conf` / `postgresql.auto.conf` (or user specify using `-U`) to database with the same name (or another specified with `-D`) as `trust` (or using password specified in `~/.pgpass`). This user must have `SUPERUSER` privilege (need to get replication details).
|
||||
|
||||
* **On standby node:** `PG_USER` must be able to connect localy on the database with the same name `(or another specified with -D)` as `trust` (or via `md5` using password specified in `~/.pgpass`).
|
||||
* **On standby node:** `PG_USER` must be able to connect localy on the database with the same name `(or another specified with -D)` as `trust` (or using password specified in `~/.pgpass`).
|
||||
|
||||
Usage
|
||||
-----
|
||||
## Installation
|
||||
|
||||
```
|
||||
Usage: check_pg_streaming_replication [-d] [-h] [options]
|
||||
apt install sudo awk sed bc postgresql-client
|
||||
git clone https://gitea.zionetrix.net/bn8/check_pg_streaming_replication.git \
|
||||
/usr/local/src/check_pg_streaming_replication
|
||||
mkdir -p /usr/local/lib/nagios/plugins
|
||||
ln -s /usr/local/src/check_pg_streaming_replication/check_pg_streaming_replication \
|
||||
/usr/local/lib/nagios/plugins/check_pg_streaming_replication
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
Usage: ./check_pg_streaming_replication [-d] [-h] [options]
|
||||
-u pg_user Specify local Postgres user (Default: try to auto-detect or use postgres)
|
||||
-b psql_bin Specify psql binary path (Default: /usr/bin/psql)
|
||||
-B pg_lsclusters_bin Specify pg_lsclusters binary path (Default: /usr/bin/pg_lsclusters)
|
||||
|
@ -47,7 +55,7 @@ Usage: check_pg_streaming_replication [-d] [-h] [options]
|
|||
-m pg_main Specify Postgres main directory path (Default: try to auto-detect or use
|
||||
/var/lib/postgresql//main)
|
||||
-r recovery_conf Specify Postgres recovery configuration file path
|
||||
(Default: [PG_MAIN]/recovery.conf)
|
||||
(Default: [PG_MAIN]/recovery.conf for PG <= 11, [PG_MAIN]/postgresql.auto.conf for PG >= 12)
|
||||
-U pg_master_user Specify Postgres user to use on master (Default: user from recovery.conf file)
|
||||
-p pg_port Specify default Postgres master TCP port (Default: same as local PostgreSQL
|
||||
port if detected or use 5432)
|
||||
|
@ -57,17 +65,15 @@ Usage: check_pg_streaming_replication [-d] [-h] [options]
|
|||
of the last received LSN (Default: 1)
|
||||
-w replay_warn_delay Specify the replay warning delay in second (Default: 3)
|
||||
-c replay_crit_delay Specify the replay critical delay in second (Default: 5)
|
||||
-e expected_sync_state The expected replication state ('sync' or 'async', default: sync)
|
||||
-d Debug mode
|
||||
-h Show this message
|
||||
```
|
||||
|
||||
Copyright
|
||||
---------
|
||||
## Copyright
|
||||
|
||||
Copyright (c) 2014-2020 Benjamin Renard
|
||||
Copyright (c) 2014-2024 Benjamin Renard
|
||||
|
||||
License
|
||||
-------
|
||||
## License
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
|
|
|
@ -8,19 +8,19 @@
|
|||
#
|
||||
# Some CLI tools: sudo, awk, sed, bc, psql and pg_lscluster
|
||||
#
|
||||
# On master node: Slaves must be able to connect with user from recovery.conf
|
||||
# (or user specify using -U) to database with the same name
|
||||
# (or another specified with -D) as trust (or via md5 using
|
||||
# password specified in ~/.pgpass). This user must have
|
||||
# SUPERUSER privilege (need to get replication details).
|
||||
# On master node: Slave nodes must be able to connect with user from recovery.conf /
|
||||
# `postgresql.auto.conf` (or user specify using -U) to database with the same
|
||||
# name (or another specified with -D) as trust (or using password specified in
|
||||
# ~/.pgpass). This user must have SUPERUSER privilege (need to get replication
|
||||
# details).
|
||||
#
|
||||
# On standby node: PG_USER must be able to connect localy on the database
|
||||
# with the same name (or another specified with -D) as trust
|
||||
# (or via md5 using password specified in ~/.pgpass).
|
||||
# On standby node: PG_USER must be able to connect localy on the database with the same name
|
||||
# (or another specified with -D) as trust (or using password specified in
|
||||
# ~/.pgpass).
|
||||
#
|
||||
# Author: Benjamin Renard <brenard@easter-eggs.com>
|
||||
# Date: Wed, 04 Nov 2020 15:31:13 +0100
|
||||
# Source: https://gogs.zionetrix.net/bn8/check_pg_streaming_replication
|
||||
# Date: Mon, 03 Jun 2024 15:31:29 +0200
|
||||
# Source: https://gitea.zionetrix.net/bn8/check_pg_streaming_replication
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
|
||||
|
|
Loading…
Reference in a new issue