From bf241ba1d6f74ee2b816368e374986188237cba8 Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Fri, 6 Jul 2012 01:51:22 -0500 Subject: [PATCH] Make the monitoring history capabilities of repmgr be optional and turned off by default. Most of it has been superseeded by pg_stat_replication view, we can still start it by using the switch --monitoring-history --- README.rst | 5 +++++ repmgrd.c | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 1cbd978a..3b010389 100644 --- a/README.rst +++ b/README.rst @@ -1013,6 +1013,7 @@ The output from this program looks like this:: --help show this help, then exit --version output version information, then exit --verbose output verbose activity information + --monitoring-history track advance or lag of the replication in every standby in repl_monitor -f, --config_file=PATH database to connect to repmgrd monitors a cluster of servers. @@ -1043,6 +1044,10 @@ Lag monitoring repmgrd helps monitor a set of master and standby servers. You can see which node is the current master, as well as how far behind each is from current. +To activate the monitor capabilities of repmgr you must include the +option --monitoring-history when running it:: + + repmgrd --monitoring-history --config-file=/path/to/repmgr.conf & To look at the current lag between primary and each node listed in ``repl_node``, consult the ``repl_status`` view:: diff --git a/repmgrd.c b/repmgrd.c index bb32f66e..e07ec0df 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -65,7 +65,7 @@ const char *progname; char *config_file = DEFAULT_CONFIG_FILE; bool verbose = false; -bool no_history = false; +bool monitoring_history = false; char repmgr_schema[MAXLEN]; /* @@ -114,7 +114,7 @@ main(int argc, char **argv) { {"config", required_argument, NULL, 'f'}, {"verbose", no_argument, NULL, 'v'}, - {"no-history", no_argument, NULL, 'N'}, + {"monitoring-history", no_argument, NULL, 'm'}, {NULL, 0, NULL, 0} }; @@ -139,7 +139,7 @@ main(int argc, char **argv) } } - while ((c = getopt_long(argc, argv, "f:v:N", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "f:v:m", long_options, &optindex)) != -1) { switch (c) { @@ -149,8 +149,8 @@ main(int argc, char **argv) case 'v': verbose = true; break; - case 'N': - no_history = true; + case 'm': + monitoring_history = true; break; default: usage(); @@ -358,7 +358,7 @@ WitnessMonitor(void) } /* Fast path for the case where no history is requested */ - if (no_history) + if (!monitoring_history) return; /* @@ -479,7 +479,7 @@ StandbyMonitor(void) } /* Fast path for the case where no history is requested */ - if (no_history) + if (!monitoring_history) return; /* @@ -925,6 +925,7 @@ void help(const char *progname) printf(_(" --help show this help, then exit\n")); printf(_(" --version output version information, then exit\n")); printf(_(" --verbose output verbose activity information\n")); + printf(_(" --monitoring-history track advance or lag of the replication in every standby in repl_monitor\n")); printf(_(" -f, --config_file=PATH configuration file\n")); printf(_("\n%s monitors a cluster of servers.\n"), progname); }