forked from netobserv/netobserv-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate-doc.sh
More file actions
executable file
·142 lines (126 loc) · 4.09 KB
/
generate-doc.sh
File metadata and controls
executable file
·142 lines (126 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env bash
source "./scripts/help.sh"
ADOC=./docs/netobserv_cli.adoc
# Header
echo "// Automatically generated by '$0'. Do not edit, or make the NETOBSERV team aware of the editions.
:_mod-docs-content-type: REFERENCE
[id=\"network-observability-netobserv-cli-reference_{context}\"]
= Network Observability CLI usage
You can use the Network Observability CLI (\`oc netobserv\`) to pass command line arguments to capture flows data, packets data, and metrics for further analysis and enable features supported by the Network Observability Operator.
[id=\"cli-syntax_{context}\"]
== Syntax
The basic syntax for \`oc netobserv\` commands:
.\`oc netobserv\` syntax
[source,terminal]
----
$ oc netobserv [<command>] [<feature_option>] [<command_options>] <1>
----
<1> Feature options can only be used with the \`oc netobserv flows\` command. They cannot be used with the \`oc netobserv packets\` command.
[id=\"cli-basic-commands_{context}\"]
== Basic commands
[cols=\"3a,8a\",options=\"header\"]
.Basic commands
|===
| Command | Description
| flows
| Capture flows information. For subcommands, see the \"Flows capture options\" table.
| packets
| Capture packets data. For subcommands, see the \"Packets capture options\" table.
| metrics
| Capture metrics data. For subcommands, see the \"Metrics capture options\" table.
| follow
| Follow collector logs when running in background.
| stop
| Stop collection by removing agent daemonset.
| copy
| Copy collector generated files locally.
| cleanup
| Remove the Network Observability CLI components.
| version
| Print the software version.
| help
| Show help.
|===
" > $ADOC
# flows table
{
echo "[id=\"cli-reference-flows-capture-options_{context}\"]
== Flows capture options
Flows capture has mandatory commands as well as additional options, such as enabling extra features about packet drops, DNS latencies, Round-trip time, and filtering.
.\`oc netobserv flows\` syntax
[source,terminal]
----
$ oc netobserv flows [<feature_option>] [<command_options>]
----
[cols=\"1,1,1\",options=\"header\"]
|===
| Option | Description | Default"
features_usage
collector_usage
filters_usage
specific_filters_usage
echo -e "|==="
# flows example
echo "
.Example running flows capture on TCP protocol and port 49051 with PacketDrop and RTT features enabled:
[source,terminal]
----
$ oc netobserv flows --enable_pkt_drop --enable_rtt --enable_filter --action=Accept --cidr=0.0.0.0/0 --protocol=TCP --port=49051
----"
# packets table
echo "[id=\"cli-reference-packet-capture-options_{context}\"]
== Packets capture options
You can filter packets capture data the as same as flows capture by using the filters.
Certain features, such as packets drop, DNS, RTT, and network events, are only available for flows and metrics capture.
.\`oc netobserv packets\` syntax
[source,terminal]
----
$ oc netobserv packets [<option>]
----
[cols=\"1,1,1\",options=\"header\"]
|===
| Option | Description | Default"
collector_usage
filters_usage
echo -e "|==="
# packets example
echo "
.Example running packets capture on TCP protocol and port 49051:
[source,terminal]
----
$ oc netobserv packets --action=Accept --cidr=0.0.0.0/0 --protocol=TCP --port=49051
----"
# Metrics table
echo "[id=\"cli-reference-metrics-capture-options_{context}\"]
== Metrics capture options
You can enable features and use filters on metrics capture, the same as flows capture. The generated graphs fill accordingly in the dashboard.
.\`oc netobserv metrics\` syntax
[source,terminal]
----
$ oc netobserv metrics [<option>]
----
[cols=\"1,1,1\",options=\"header\"]
|===
| Option | Description | Default"
features_usage
filters_usage
specific_filters_usage
echo -e "|==="
# Metrics example
echo "
.Example running metrics capture for TCP drops
[source,terminal]
----
$ oc netobserv metrics --enable_pkt_drop --enable_filter --protocol=TCP
----"
} >> $ADOC
# remove double spaces
sed -i.bak "s/ */ /" $ADOC
# add table rows
sed -i.bak "/^ /s/ --*/|--/" $ADOC
# add table columns
sed -i.bak "/^|/s/(default: n\/a/| -/" $ADOC # replace n/a by - in the docs
sed -i.bak "/^|/s/(default:/|/" $ADOC
sed -i.bak "/^|/s/: /|/" $ADOC
sed -i.bak "/^|/s/)//" $ADOC
rm ./docs/*.bak