mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
daemon status: with csv output, show repmgrd status as unknown where appropriate
Previously, if PostgreSQL was not running on the node, repmgrd and pause status were shown as "0", implying their status was known. This brings the csv output in line with the human-readable output, which displays "n/a" in this case.
This commit is contained in:
@@ -33,7 +33,10 @@
|
|||||||
<command>repmgr daemon status</command> can be executed on any active node in the
|
<command>repmgr daemon status</command> can be executed on any active node in the
|
||||||
replication cluster. A valid <filename>repmgr.conf</filename> file is required.
|
replication cluster. A valid <filename>repmgr.conf</filename> file is required.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
If PostgreSQL is not running on a node, &repmgr; will not be able to determine the
|
||||||
|
status of that node's <application>repmgrd</application> instance.
|
||||||
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
After restarting PostgreSQL on any node, the <application>repmgrd</application> instance
|
After restarting PostgreSQL on any node, the <application>repmgrd</application> instance
|
||||||
@@ -126,19 +129,19 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<simpara>
|
<simpara>
|
||||||
<application>repmgrd</application> running (1 = running, 0 = not running)
|
<application>repmgrd</application> running (1 = running, 0 = not running, -1 = unknown)
|
||||||
</simpara>
|
</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<simpara>
|
<simpara>
|
||||||
<application>repmgrd</application> PID (-1 if not running)
|
<application>repmgrd</application> PID (-1 if not running or status unknown)
|
||||||
</simpara>
|
</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<simpara>
|
<simpara>
|
||||||
<application>repmgrd</application> paused (1 = paused, 0 = not paused)
|
<application>repmgrd</application> paused (1 = paused, 0 = not paused, -1 = unknown)
|
||||||
</simpara>
|
</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
@@ -150,7 +153,7 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<simpara>
|
<simpara>
|
||||||
interval in seconds since the node's upstream was last seen
|
interval in seconds since the node's upstream was last seen (this will be -1 if the value could not be retrieved, or the node is primary)
|
||||||
</simpara>
|
</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
|||||||
@@ -260,14 +260,24 @@ do_daemon_status(void)
|
|||||||
{
|
{
|
||||||
if (runtime_options.output_mode == OM_CSV)
|
if (runtime_options.output_mode == OM_CSV)
|
||||||
{
|
{
|
||||||
|
int running = repmgrd_info[i]->running ? 1 : 0;
|
||||||
|
int paused = repmgrd_info[i]->paused ? 1 : 0;
|
||||||
|
|
||||||
|
/* If PostgreSQL is not running, repmgrd status is unknown */
|
||||||
|
if (repmgrd_info[i]->pg_running == false)
|
||||||
|
{
|
||||||
|
running = -1;
|
||||||
|
paused = -1;
|
||||||
|
}
|
||||||
|
|
||||||
printf("%i,%s,%s,%i,%i,%i,%i,%i,%i\n",
|
printf("%i,%s,%s,%i,%i,%i,%i,%i,%i\n",
|
||||||
cell->node_info->node_id,
|
cell->node_info->node_id,
|
||||||
cell->node_info->node_name,
|
cell->node_info->node_name,
|
||||||
get_node_type_string(cell->node_info->type),
|
get_node_type_string(cell->node_info->type),
|
||||||
repmgrd_info[i]->pg_running ? 1 : 0,
|
repmgrd_info[i]->pg_running ? 1 : 0,
|
||||||
repmgrd_info[i]->running ? 1 : 0,
|
running,
|
||||||
repmgrd_info[i]->pid,
|
repmgrd_info[i]->pid,
|
||||||
repmgrd_info[i]->paused ? 1 : 0,
|
paused,
|
||||||
cell->node_info->priority,
|
cell->node_info->priority,
|
||||||
repmgrd_info[i]->pid == UNKNOWN_PID
|
repmgrd_info[i]->pid == UNKNOWN_PID
|
||||||
? -1
|
? -1
|
||||||
|
|||||||
Reference in New Issue
Block a user