Monitoring Replication

Currently, Database Performance Monitor supports monitoring replication for PostgreSQL and MySQL.

DPM can typically monitor replication with no additional configuration, using PostgreSQL’s built-in system administration functions and MySQL’s SHOW SLAVE STATUS. This allows us to reconstruct the replication topology and track replication issues. If you are using a MySQL environment without unique server IDs, see below for additional details.

Setting up an Alert

Using the Alerts page, you can be notified if the replication delay becomes too large.

To do this, set up a threshold alert triggered on one of these two metrics, depending on your database technology:

Database Metric
PostgreSQL pgsql.status.replication_delay_us
MySQL mysql.status.replication_delay_us

These metrics are measured in microseconds, so a replication delay of “25 seconds” would be entered as “25000000.” Follow the instructions on the Alerts page for more details of setting up alerts, and do not hesitate to contact us with any questions.

Monitoring MySQL Without Unique Server IDs

If your infrastructure has multiple hosts with the same server id, then replication monitoring is still possible using the “heartbeat” approach. Here, DPM uses an auxiliary heartbeat table to reconstruct the replication topology by tracking sample data as it is replicated through the servers. If you wish to use this approach, you must create a vividcortex.heartbeat table on each server you wish to monitor, and you must give the agent user permission to access that table.

Here are the necessary statements to create ‘vividcortex.heartbeat’:

CREATE DATABASE vividcortex;
CREATE TABLE vividcortex.heartbeat (
  server_id int unsigned NOT NULL PRIMARY KEY,
  host_id int unsigned NOT NULL,
  ts double NOT NULL

The necessary privileges are as follows:

GRANT SELECT, INSERT, UPDATE ON vividcortex.heartbeat TO vividcortex@'%';

If for some reason you wish to use a database and table name different from vividcortex.heartbeat then contact us and we will help you set this up.

Additionally, you will need to include in the config file for vc-mysql-metrics the setting “repl-heartbeat”:true. For more information on config files, refer to our Configuration documentation.