mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 08:56:29 +00:00
repmgr node status: optional CSV output
This commit is contained in:
@@ -159,6 +159,55 @@ do_node_status(void)
|
|||||||
|
|
||||||
initPQExpBuffer(&output);
|
initPQExpBuffer(&output);
|
||||||
|
|
||||||
|
if (runtime_options.csv == true)
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
"\"Node name\",\"Node ID\",");
|
||||||
|
|
||||||
|
for (cell = node_status.head; cell; cell = cell->next)
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
"\"%s\"", cell->key);
|
||||||
|
|
||||||
|
if (cell->next)
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
"\n");
|
||||||
|
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
"%s,%i,",
|
||||||
|
node_info.node_name,
|
||||||
|
node_info.node_id);
|
||||||
|
|
||||||
|
for (cell = node_status.head; cell; cell = cell->next)
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
"\"%s\"", cell->value);
|
||||||
|
|
||||||
|
if (cell->next)
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
appendPQExpBuffer(
|
||||||
|
&output,
|
||||||
|
"\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
appendPQExpBuffer(
|
appendPQExpBuffer(
|
||||||
&output,
|
&output,
|
||||||
"Node \"%s\":\n",
|
"Node \"%s\":\n",
|
||||||
@@ -170,6 +219,7 @@ do_node_status(void)
|
|||||||
&output,
|
&output,
|
||||||
"\t%s: %s\n", cell->key, cell->value);
|
"\t%s: %s\n", cell->key, cell->value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
puts(output.data);
|
puts(output.data);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user