From 904d6facbfd45a53f6ac68dd13aa55cb3705ec75 Mon Sep 17 00:00:00 2001 From: Muhammad Usama Date: Wed, 16 Sep 2020 18:41:16 +0500 Subject: [PATCH] Documentation update for wd_cli utility Few typo fixes are also part of the commit --- doc/src/sgml/ref/allfiles.sgml | 1 + doc/src/sgml/ref/wd_cli.sgml | 284 +++++++++++++++++++++++++++++++++ doc/src/sgml/reference.sgml | 1 + src/tools/watchdog/wd_cli.c | 6 +- 4 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 doc/src/sgml/ref/wd_cli.sgml diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml index 369955f4a..e931dd021 100644 --- a/doc/src/sgml/ref/allfiles.sgml +++ b/doc/src/sgml/ref/allfiles.sgml @@ -20,6 +20,7 @@ Complete list of usable sgml source files in this directory. + diff --git a/doc/src/sgml/ref/wd_cli.sgml b/doc/src/sgml/ref/wd_cli.sgml new file mode 100644 index 000000000..5442e2492 --- /dev/null +++ b/doc/src/sgml/ref/wd_cli.sgml @@ -0,0 +1,284 @@ + + + + + wd_cli + + + + wd_cli + 1 + Other Commands + + + + wd_cli + + Watchdog Command Line Interface (CLI) utility for the + external health-check system integration. + + + + + + wd_cli + operation + node search option + option + + + + + Description + + wd_cli + Provides a convenient and easy to use interface to interact with + watchdog and perform health check related node operations. + + + + + Operations + + + + + + + + + Get the node status for node(s) based on node search criteria + + + + + + + + + + Update the watchdog node status. + Allowed values are DEAD and ALIVE + + + + + + + + + + Node Search Options + + + + + + + + + Select all nodes (only available with --info operation) + + + + + + + + + + Select watchdog node by node_id. + + + + + + + + + + Select watchdog node by name. + + + + + + + + + + Select watchdog node by hostname. + + + + + + + + + + Select watchdog node by port number. + + + + + + + + + + + Options + + + + + + + + + Watchdog auth key. + Specifying auth-key over rides the pgpool.conf->wd_authkey value. + + + + + + + + + + Specifies the pgpool.conf file. + + + + + + + + + + Path to the watchdog IPC socket directory. + Specifying socket-dir over rides the pgpool.conf->wd_ipc_socket_dir value. + + + + + + + + + + Port number of watchdog IPC socket. + Specifying ipc-port over rides the pgpool.conf->wd_port value. + + + + + + + + + + + Optional message string to be passed to Pgpool-II along with the node status. + + + + + + + + + + Enable verbose messages. + + + + + + + + + + Prints version information. + + + + + + + + + + Enable debug output. + + + + + + + + + + Prints the help for wd_cli. + + + + + + + + + + Example + + When some external health-check system is configured + to monitor the health of Pgpool-II cluster + and it detects a node failure. wd_cli utility can + be used to pass this information to Pgpool-II + cluster so that it can take the appropriate actions. + + + #inform Pgpool-II about node named RN-110 failure + wd_cli --inform DEAD -N 'RN-110' -p 9001 -m 'Pgpool node with name RN-110 is not reachable' + + + #inform Pgpool-II about node-id 10 failure + wd_cli --inform DEAD -n 10 -m 'Pgpool node with ID 10 is not responding' + + Similarly to inform Pgpool-II about the node is alive again. + + #inform Pgpool-II about node-id 10 re-joining + wd_cli --inform ALIVE -n 10 -m 'Pgpool node with ID 10 is reachable again' + + + wd_cli can also be used to get the current status of cluster nodes. + + wd_cli -f simple_conf/watchdog/pgpool_wd1.conf --info -v --all + + Total Watchdog nodes configured for lifecheck: 2 + ***************** + Node ID: 0 + Node Status code 4 + Node Status: MASTER + Node Name: localhost:9991 Linux localhost.localdomain + Node Host: localhost + Node WD Port: 9001 + Node Pgpool Port: 9991 + + Node ID: 1 + Node Status code 7 + Node Status: STANDBY + Node Name: localhost:9992 Linux localhost.localdomain + Node Host: localhost + Node WD Port: 9002 + Node Pgpool Port: 9992 + + + + + diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml index 040af9940..0841e482f 100644 --- a/doc/src/sgml/reference.sgml +++ b/doc/src/sgml/reference.sgml @@ -124,6 +124,7 @@ &pgproto; &pgpoolSetup; &watchdoglSetup; + &wdCli; diff --git a/src/tools/watchdog/wd_cli.c b/src/tools/watchdog/wd_cli.c index dfc47f58e..8f44ae166 100644 --- a/src/tools/watchdog/wd_cli.c +++ b/src/tools/watchdog/wd_cli.c @@ -662,7 +662,7 @@ print_node_info(LifeCheckNode* lifeCheckNode, bool verbose) if (verbose) { fprintf(stdout,"Node ID: %d\n",lifeCheckNode->ID); - fprintf(stdout,"Node Status code %d\n",lifeCheckNode->wdState); + fprintf(stdout,"Node Status code: %d\n",lifeCheckNode->wdState); fprintf(stdout,"Node Status: %s\n",lifeCheckNode->stateName); fprintf(stdout,"Node Name: %s\n",lifeCheckNode->nodeName); fprintf(stdout,"Node Host: %s\n",lifeCheckNode->hostName); @@ -713,7 +713,7 @@ usage(void) fprintf(stderr, "%s version %s (%s)\n", PACKAGE, VERSION, PGPOOLVERSION); fprintf(stderr, "\nUsage:\n"); - fprintf(stderr, " %s [ operation] [ options] [node srarch criteria]\n",progname); + fprintf(stderr, " %s [ operation] [ options] [node search criteria]\n",progname); fprintf(stderr, "\n Operations:\n"); fprintf(stderr, " -i, --info Get the node status for nodes based on node search criteria\n"); @@ -725,7 +725,7 @@ usage(void) fprintf(stderr, " -a, --all Search all nodes (only available with --info option)\n"); fprintf(stderr, " -n, --node-id=ID Search watchdog node with node_id\n"); fprintf(stderr, " -N, --node-name=Name Search watchdog node with name\n"); - fprintf(stderr, " -H, --node-name=Host Search watchdog node with Host\n"); + fprintf(stderr, " -H, --node-host=Host Search watchdog node with Host\n"); fprintf(stderr, " -P, --node-port=port Search watchdog node with wd_port\n"); fprintf(stderr, "\n Options:\n"); -- 2.39.5