From 2b7ad25bc1e0ec4809fe4e1d175bfcc9360aabcf Mon Sep 17 00:00:00 2001
From: Greg Sabino Mullane check_postgres.pl - a Postgres monitoring script for Nagios, MRTG, Cacti, and others This documents describes check_postgres.pl version 2.13.2 This documents describes check_postgres.pl version 2.14.0
NAME
@@ -1017,6 +1018,44 @@ assumed to be seconds.
+
(symlink: check_postgres_replicate_row) Checks that master-slave replication is working to one or more slaves.
+The slaves are specified the same as the normal databases, except with
+the number 2 at the end of them, so "--port2" instead of "--port", etc.
+The values or the --warning and --critical options are units of time, and
+at least one must be provided (no defaults). Valid units are 'seconds', 'minutes', 'hours',
+or 'days'. Each may be written singular or abbreviated to just the first letter.
+If no units are given, the units are assumed to be seconds.
This check updates a single row on the master, and then measures how long it
+takes to be applied to the slaves. To do this, you need to pick a table that
+is being replicated, then find a row that can be changed, and is not going
+to be changed by any other process. A specific column of this row will be changed
+from one value to another. All of this is fed to the repinfo option, and should
+contain the following options, separated by commas: table name, primary key, key id,
+column, first value, second value.
Example 1: Slony is replicating a table named 'orders' from host 'alpha' to +host 'beta', in the database 'sales'. The primary key of the table is named +id, and we are going to test the row with an id of 3 (which is historical and +never changed). There is a column named 'salesrep' that we are going to toggle +from a value of 'slon' to 'nols' to check on the replication. We want to throw +a warning if the replication does not happen within 10 seconds.
++ check_postgres_replicate_row --host=alpha --dbname=sales --host2=beta + --dbname2=sales --warning=10 --repinfo=orders,id,3,salesrep,slon,nols+
Example 2: Bucardo is replicating a table named 'receipt' from host 'green' +to hosts 'red', 'blue', and 'yellow'. The database for both sides is 'public'. +The slave databases are running on port 5455. The primary key is named 'receipt_id', +the row we want to use has a value of 9, and the column we want to change for the +test is called 'zone'. We'll toggle between 'north' and 'south' for the value of +this column, and throw a critical if the change is not on all three slaves within 5 seconds.
++ check_postgres_replicate_row --host=green --port2=5455 --host2=red,blue,yellow + --critical=5 --repinfo=receipt,receipt_id,9,zone,north,south+
For MRTG output, returns on the first line the time in seconds the replication takes to finish. +The maximum time is set to 4 minutes 30 seconds: if no replication has taken place in that long +a time, an error is thrown.
++
(symlink: check_postgres_same_schema) Verifies that two databases are identical as far as their
schema (but not the data within). This is particularly handy for making sure your slaves have not
@@ -1099,42 +1138,19 @@ if there are more than one sequence at that percentage.
-
(symlink: check_postgres_replicate_row) Checks that master-slave replication is working to one or more slaves.
-The slaves are specified the same as the normal databases, except with
-the number 2 at the end of them, so "--port2" instead of "--port", etc.
-The values or the --warning and --critical options are units of time, and
-at least one must be provided (no defaults). Valid units are 'seconds', 'minutes', 'hours',
-or 'days'. Each may be written singular or abbreviated to just the first letter.
-If no units are given, the units are assumed to be seconds.
This check updates a single row on the master, and then measures how long it
-takes to be applied to the slaves. To do this, you need to pick a table that
-is being replicated, then find a row that can be changed, and is not going
-to be changed by any other process. A specific column of this row will be changed
-from one value to another. All of this is fed to the repinfo option, and should
-contain the following options, separated by commas: table name, primary key, key id,
-column, first value, second value.
Example 1: Slony is replicating a table named 'orders' from host 'alpha' to -host 'beta', in the database 'sales'. The primary key of the table is named -id, and we are going to test the row with an id of 3 (which is historical and -never changed). There is a column named 'salesrep' that we are going to toggle -from a value of 'slon' to 'nols' to check on the replication. We want to throw -a warning if the replication does not happen within 10 seconds.
+(symlink: check_postgres_slony_status) Checks in the status of a Slony cluster by looking
+at the results of Slony's sl_status view. This is returned as the number of seconds of "lag time".
+The --warning and --critical options should be expressed as times. The default values
+are 60 seconds for the warning and 300 seconds for the critical.
The optional argument --schema indicated the schema that Slony is installed under. If it is +not given, the schema will be determined automatically each time this check is run.
+Example 1: Give a warning if any Slony is lagged by more than 20 seconds
- check_postgres_replicate_row --host=alpha --dbname=sales --host2=beta - --dbname2=sales --warning=10 --repinfo=orders,id,3,salesrep,slon,nols-
Example 2: Bucardo is replicating a table named 'receipt' from host 'green' -to hosts 'red', 'blue', and 'yellow'. The database for both sides is 'public'. -The slave databases are running on port 5455. The primary key is named 'receipt_id', -the row we want to use has a value of 9, and the column we want to change for the -test is called 'zone'. We'll toggle between 'north' and 'south' for the value of -this column, and throw a critical if the change is not on all three slaves within 5 seconds.
+ check_postgres_slony_status --warning 20 +Example 2: Give a critical if Slony, installed under the schema "_slony", is over 10 minutes lagged
- check_postgres_replicate_row --host=green --port2=5455 --host2=red,blue,yellow - --critical=5 --repinfo=receipt,receipt_id,9,zone,north,south-
For MRTG output, returns on the first line the time in seconds the replication takes to finish. -The maximum time is set to 4 minutes 30 seconds: if no replication has taken place in that long -a time, an error is thrown.
+ check_postgres_slony_sytatus --schema=_slony --critical=600
Items not specifically attributed are by Greg Sabino Mullane.
+ Added the 'slony_status' action. + Changed the logfile sleep from 0.5 to 1, as 0.5 gets rounded to 0 on some boxes!+
+ Allow timeout option to be used for logtime 'sleep' time.+
Show offending database for query_time action. @@ -1464,7 +1493,7 @@ feature requests, and commit notices, send email to Version 2.13.0 (January 29, 2010) +
-- 2.39.5