PostgreSQL Replication Status Test

The process of copying data from a PostgreSQL database server to another server is called PostgreSQL Replication. The source database server is usually called the Master server, whereas the database server receiving the copied data is called the Replica server.

In a high availability environment, the replica servers should always be in sync with the master database instance. For this, the replication should always be enabled on the master and the replica servers should be connected to the master at all times. If the replication fails even for a brief period or if the replica servers are not connected to the master, the replica servers will not be upto date. To avoid this, it is essential to monitor the replication status of the master PostgreSQL database server. The PostgreSQL Replication Status test helps administrators in this regard!

This test reports whether/not the replication process is enabled on the target database server and also helps administrators figure out if the target database server is the master or not. Additionally, this test reports the count of replica servers connected to the target database server.

Target of the test : PostgreSQL server

Agent deploying the test: An internal/remote agent

Outputs of the test : One set of results for the target PostgreSQL server

Configurable parameters for the test
Parameter Description

Test period

How often should the test be executed

Host

The IP address of the host for which this test is to be configured.

Port

The port on which the server is listening. The default port is 5432.

Username

In order to monitor a PostgreSQL server, you need to manually create a special database user account in every PostgreSQL database instance that requires monitoring. When doing so, ensure that this user is vested with the superuser privileges. The sample script we recommend for user creation for eG monitoring is:

CREATE ROLE eguser LOGIN



ENCRYPTED PASSWORD {‘eguser password’}



SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;

Specify the name of this user in the Username text box.

Password

The password associated with the above Username (can be ‘NULL’). Here, ‘NULL’ means that the user does not have any password.

Confirm Password

Confirm the Password (if any) by retyping it here.

DB Name

The name of the database to connect to. The default is “postgres”.

SSL

If the PostgreSQL server being monitored is an SSL-enabled server, then set the SSL flag to Yes. If not, then set the SSL flag to No.

Detailed Diagnosis

To make diagnosis more efficient and accurate, the eG Enterprise embeds an optional detailed diagnostic capability. With this capability, the eG agents can be configured to run detailed, more elaborate tests as and when specific problems are detected. To enable the detailed diagnosis capability of this test for a particular server, choose the On option. To disable the capability, click on the Off option.

The option to selectively enable/disable the detailed diagnosis capability will be available only if the following conditions are fulfilled:

  • The eG manager license should allow the detailed diagnosis capability
  • Both the normal and abnormal frequencies configured for the detailed diagnosis measures should not be 0.
Measurements made by the test
Measurement Description Measurement Unit Interpretation

Is replication enabled?

Indicates whether/not replication is enabled on the target database server.

 

The values reported by this measure and its numeric equivalents are mentioned in the table below:

Measure Value Numeric Value
Yes 1
No 0

Note:

By default, this measure reports the Measure Values listed in the table above to indicate whether/not replication is enabled on the server. The graph of this measure however, is represented using the numeric equivalents only i.e., 0 or 1.

Is master?

Indicates whether/not the database server is the master.

 

The values reported by this measure and its numeric equivalents are mentioned in the table below:

Measure Value Numeric Value
Yes 1
No 0

Note:

By default, this measure reports the Measure Values listed in the table above to indicate whether/not the server is the master. The graph of this measure however, is represented using the numeric equivalents only i.e., 0 or 1.

Slave nodes

Indicates the number of replica servers attached to the database server.

Number

This measure will be reported only if the Is master? measure reports a value of Yes.

If the value of this measure decreases gradually, backup data could not be replicated by the master database server and hence data could not be retrieved if the master database server crashes.