ovsdb-client: Add support for pretty-printing JSON in output.
[openvswitch] / ovsdb / ovsdb-client.1.in
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .\" -*- nroff -*-
8 .TH ovsdb\-client 1 "November 2009" "Open vSwitch" "Open vSwitch Manual"
9 .ds PN ovsdb\-client
10 .
11 .SH NAME
12 ovsdb\-client \- command-line interface to \fBovsdb-server\fR(1)
13 .
14 .SH SYNOPSIS
15 \fBovsdb\-client \fR[\fIoptions\fR] \fBget-schema\fI server\fR
16 .br
17 \fBovsdb\-client \fR[\fIoptions\fR] \fBlist-tables\fI server\fR
18 .br
19 \fBovsdb\-client \fR[\fIoptions\fR] \fBlist-columns\fI server \fR[\fItable\fR]
20 .br
21 \fBovsdb\-client \fR[\fIoptions\fR] \fBtransact\fI server transaction\fR
22 .br
23 \fBovsdb\-client \fR[\fIoptions\fR] \fBmonitor\fI server table\fR
24 [\fIcolumn\fR[\fB,\fIcolumn\fR]...]
25 [\fIselect\fR[\fB,\fIselect\fR]...]
26 .br
27 \fBovsdb\-client help\fR
28 .IP "Output formatting options:"
29 [\fB--format=\fIformat\fR]
30 [\fB--wide\fR]
31 [\fB--no-heading\fR]
32 .so lib/daemon-syn.man
33 .so lib/vlog-syn.man
34 .so lib/common-syn.man
35 .
36 .SH DESCRIPTION
37 The \fBovsdb\-client\fR program is a command-line client for
38 interacting with a running \fBovsdb\-server\fR process.  For each
39 command, the \fIserver\fR to connect to must be specified in one of
40 the following forms:
41 .IP "\fBtcp:\fIip\fB:\fIport\fR"
42 Connect to the given TCP \fIport\fR on \fIip\fR.
43 .IP "\fBunix:\fIfile\fR"
44 Connect to the Unix domain server socket named \fIfile\fR.
45 .IP "\fBptcp:\fIport\fR[\fB:\fIip\fR]"
46 Listen on the given TCP \fIport\fR for a connection.  By default,
47 \fB\*(PN\fR listens for connections to any local IP address, but
48 \fIip\fR may be specified to listen only for connections to the given
49 \fIip\fR.
50 .IP "\fBpunix:\fIfile\fR"
51 Listen on the Unix domain server socket named \fIfile\fR for a
52 connection.
53 .
54 .SS "Commands"
55 The following commands are implemented:
56 .IP "\fBget-schema\fI server\fR"
57 Connects to \fIserver\fR, retrieves the database schema, and prints it
58 in JSON format.
59 .
60 .IP "\fBlist-tables\fI server\fR"
61 Connects to \fIserver\fR, retrieves the database schema, and prints
62 a table listing the names and comments (if any) on each table within
63 the database.
64 .
65 .IP "\fBlist-columns\fI server \fR[\fItable\fR]"
66 Connects to \fIserver\fR, retrieves the database schema, and prints
67 a table listing the names, type, and comment (if any) on each column.  If
68 \fItable\fR is specified, only columns in that table are listed;
69 otherwise, the tables include columns in all tables.
70 .
71 .IP "\fBtransact\fI server transaction\fR"
72 Connects to \fIserver\fR, sends it the specified \fItransaction\fR,
73 which must be a JSON array containing one or more valid OVSDB
74 operations, and prints the received reply on stdout.
75 .
76 .IP "\fBmonitor\fI server table\fR [\fIcolumn\fR[\fB,\fIcolumn\fR]...] [\fIselect\fR[\fB,\fIselect\fR]...]"
77 Connects to \fIserver\fR and monitors the contents of \fItable\fR.  By
78 default, the initial contents of \fItable\fR are printed, followed by
79 each change as it occurs.  If at least one \fIcolumn\fR is specified,
80 only those columns are monitored.  If at least one \fIselect\fR is
81 specified, they are interpreted as follows:
82 .RS
83 .IP "\fBinitial\fR"
84 Print the initial contents of the specified columns.
85 .IP "\fBinsert\fR"
86 Print newly inserted rows.
87 .IP "\fBdelete\fR"
88 Print deleted rows.
89 .IP "\fBmodify\fR"
90 Print old and new values of modified rows.
91 .RE
92 .IP
93 If \fB--detach\fR is used with \fBmonitor\fR, then \fBovsdb\-client\fR
94 detaches after it has successfully received and printed the initial
95 contents of \fItable\fR.
96 .SH OPTIONS
97 .SS "Output Formatting Options"
98 Much of the output from \fBovsdb\-client\fR is in the form of tables.
99 The following options controlling output formatting:
100 .
101 .IP "\fB-f \fIformat\fR"
102 .IQ "\fB--format=\fIformat\fR"
103 Sets the basic type of output formatting.  The following types of
104 \fIformat\fR are available:
105 .RS
106 .IP "\fBtable\fR (default)"
107 Text-based tables with aligned columns.
108 .IP "\fBhtml\fR"
109 HTML tables.
110 .IP "\fBcvs\fR"
111 Comma-separated values as defined in RFC 4180.
112 .RE
113 .
114 .IP "\fB--wide\fR"
115 In \fBtable\fR output (the default), when standard output is a
116 terminal device, by default lines are truncated at a width of 79
117 characters.  Specifying this option prevents line truncation.
118 .
119 .IP "\fB--no-heading\fR"
120 This option suppresses the heading row that otherwise appears in the
121 first row of table output.
122 .
123 .IP "\fB--pretty\fR"
124 By default, JSON in output is printed as compactly as possible.  This
125 option causes JSON in output to be printed in a more readable
126 fashion.  Members of objects and elements of arrays are printed one
127 per line, with indentation.
128 .IP
129 This option does not affect JSON in tables, which is always printed
130 compactly.
131 .
132 .SS "Daemon Options"
133 The daemon options apply only to the \fBmonitor\fR command.  With any
134 other command, they have no effect.
135 .so lib/daemon.man
136 .SS "Logging Options"
137 .so lib/vlog.man
138 .SS "Logging Options"
139 .so lib/vlog.man
140 .SS "Other Options"
141 .so lib/common.man
142 .SH "SEE ALSO"
143 .
144 \fBovsdb\-server\fR(1),
145 \fBovsdb\-client\fR(1),
146 and the OVSDB specification.