Skip to content

Commit 1beab23

Browse files
committed
NETOBSERV-2646: help page, write examples on subcommands
Also some minor changes such as capitalizing new line headers, little typos, Netobserv=>NetObserv
1 parent 8f1c2ea commit 1beab23

File tree

3 files changed

+72
-60
lines changed

3 files changed

+72
-60
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Then, run it as a `kubectl` plugin, such as:
3636
```bash
3737
kubectl netobserv --version
3838
# output example:
39-
# Netobserv CLI version v0.0.8
39+
# NetObserv CLI version v0.0.8
4040
```
4141

4242
You can get detailed help using these commands:

e2e/script_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestHelpCommand(t *testing.T) {
2525

2626
assert.NotEmpty(t, output)
2727
// ensure help display overall description
28-
assert.Contains(t, output, "Netobserv allows you to capture flows, packets and metrics from your cluster.")
28+
assert.Contains(t, output, "NetObserv allows you to capture flows, packets and metrics from your cluster.")
2929
assert.Contains(t, output, "Find more information at: https://github.com/netobserv/network-observability-cli/")
3030
// ensure help to display main commands
3131
assert.Contains(t, output, "main commands:")
@@ -65,6 +65,6 @@ func TestVersionCommand(t *testing.T) {
6565

6666
assert.NotEmpty(t, output)
6767
// ensure version display test
68-
assert.Contains(t, output, "Netobserv CLI version test")
68+
assert.Contains(t, output, "NetObserv CLI version test")
6969
})
7070
}

scripts/help.sh

Lines changed: 69 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,69 @@ includeList="namespace_flows_total,node_ingress_bytes_total,node_egress_bytes_to
66
# display main help
77
function help {
88
echo
9-
echo "Netobserv allows you to capture flows, packets and metrics from your cluster."
9+
echo "NetObserv allows you to capture flows, packets and metrics from your cluster."
1010
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
1111
echo
1212
echo "Syntax: netobserv [flows|packets|metrics|follow|stop|copy|cleanup|version] [options]"
1313
echo
14-
echo "main commands:"
14+
echo "Main commands:"
1515
echo " flows Capture flows information in JSON format using collector pod."
1616
echo " metrics Capture metrics information in Prometheus using a ServiceMonitor (OCP cluster only)."
1717
echo " packets Capture packets information in pcap format using collector pod."
1818
echo
19-
echo "extra commands:"
19+
echo "Extra commands:"
2020
echo " cleanup Remove netobserv components and configurations."
2121
echo " copy Copy collector generated files locally."
2222
echo " follow Follow collector logs when running in background."
2323
echo " stop Stop collection by removing agent daemonset."
2424
echo " version Print software version."
2525
echo
26-
echo "basic examples:"
27-
echo " netobserv flows --drops # Capture dropped flows on all nodes"
28-
echo " netobserv flows --query='SrcK8S_Namespace=~\"app-.*\"' # Capture flows from any namespace starting by app-"
29-
echo " netobserv packets --port=8080 # Capture packets on port 8080"
30-
echo " netobserv metrics --enable_all # Capture default cluster metrics including packet drop, dns, rtt, network events packet translation and UDN mapping features informations"
31-
echo
32-
echo "advanced examples:"
33-
echo " Capture flows in background and copy output locally"
34-
echo " netobserv flows --background \ # Capture flows using background mode"
35-
echo " --max-time=15m \ # for a maximum of 15 minutes"
36-
echo " --protocol=TCP --port=8080 \ # either on TCP 8080"
37-
echo " or --protocol=UDP # or UDP"
38-
echo " netobserv follow # Display the progression of the background capture"
39-
echo " netobserv stop # Stop the background capture by deleting eBPF agents"
40-
echo " netobserv copy # Copy the background capture output data"
41-
echo " netobserv cleanup # Cleanup netobserv CLI by removing the remaining collector pod"
42-
echo
43-
echo " Capture flows from a specific pod"
44-
echo " netobserv flows # Capture flows"
45-
echo " --node-selector=kubernetes.io/hostname:my-node # on node matching label 'kubernetes.io/hostname=my-node'"
46-
echo " --query='SrcK8S_Name=~\".*my-pod.*\" # from any pod name containing 'my-pod'"
47-
echo " or DstK8S_Name=~\".*my-pod.*\"' # or to any pod name containing 'my-pod'"
48-
echo
49-
echo " Capture packets on specific nodes and port"
50-
echo " netobserv packets # Capture packets"
51-
echo " --node-selector=netobserv:true \ # on nodes labelled with 'netobserv=true'"
52-
echo " --port=80 \ # on port 80 only"
53-
echo " --max-bytes=100000000 # for a maximum of 100MB"
54-
echo
55-
echo " Capture node and namespace drop metrics"
56-
echo " netobserv metrics \ # Capture metrics"
57-
echo " --drops # including drops"
58-
echo " --include_list=node,namespace # for all metrics matching 'node' or 'namespace' keywords"
59-
echo
60-
echo " Capture metrics in background"
61-
echo " netobserv metrics --background \ # Capture metrics using background mode"
62-
echo " --max-time=24h # for a maximum of 24 hours"
63-
echo " Then open the URL provided by the command to visualize the netobserv-cli dashboard anytime during or after the run."
26+
echo "Flow capture examples:"
27+
flows_examples
28+
echo
29+
echo "Packet capture examples:"
30+
packets_examples
31+
echo
32+
echo "Metrics capture examples:"
33+
metrics_examples
34+
echo
35+
}
36+
37+
# flows examples
38+
function flows_examples {
39+
echo " Capture dropped flows on all nodes:"
40+
echo " netobserv flows --drops"
41+
echo " Capture flows in the background, for maximum 15 minutes, TCP on 8080 or UDP, and copy output locally:"
42+
echo " netobserv flows --background --max-time=15m --protocol=TCP --port=8080 or --protocol=UDP"
43+
echo " Capture flows from any namespace starting with 'app-': (for --query doc, see also: https://github.com/netobserv/flowlogs-pipeline/blob/main/docs/filtering.md)"
44+
echo " netobserv flows --query='SrcK8S_Namespace=~\"app-.*\"'"
45+
echo " Capture flows from/to a specific pod pattern on a specific node:"
46+
echo " netobserv flows --node-selector=kubernetes.io/hostname:my-node --query='SrcK8S_Name=~\".*my-pod.*\" or DstK8S_Name=~\".*my-pod.*\"'"
47+
}
48+
49+
# packets examples
50+
function packets_examples {
51+
echo " Capture packets on port 8080:"
52+
echo " netobserv packets --port=8080"
53+
echo " Capture packets on specific nodes (labeled with 'netobserv=true') and port, for a maximum of 100MB:"
54+
echo " netobserv packets --node-selector=netobserv:true --port=80 --max-bytes=100000000"
55+
}
56+
57+
# metrics examples
58+
function metrics_examples {
59+
echo " Capture default cluster metrics including packet drop, dns, rtt, network events packet translation and UDN mapping features:"
60+
echo " netobserv metrics --enable_all"
61+
echo " Capture node and namespace drop metrics, based on keywords include list:"
62+
echo " netobserv metrics --drops --include_list=node,namespace"
63+
echo " Capture metrics in the background for 1 day:"
64+
echo " netobserv metrics --background --max-time=24h"
65+
echo " Then open the URL provided by the command to visualize the netobserv-cli dashboard anytime during or after the run."
6466
echo
6567
}
6668

6769
# display version
6870
function version {
69-
echo "Netobserv CLI version $1"
71+
echo "NetObserv CLI version $1"
7072
}
7173

7274
# agent / flp features
@@ -143,62 +145,72 @@ function metrics_options {
143145

144146
function flows_usage {
145147
echo
146-
echo "Netobserv allows you to capture flows from your cluster."
148+
echo "NetObserv allows you to capture flows from your cluster."
147149
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
148150
echo
149151
echo "Syntax: netobserv flows [options]"
150152
echo
151-
echo "features:"
153+
echo "Features:"
152154
features_usage
153155
echo
154-
echo "filters:"
156+
echo "Filters:"
155157
filters_usage
156158
flowsAndMetrics_filters_usage
157159
echo
158-
echo "options:"
160+
echo "Options:"
159161
flowsAndPackets_collector_usage
160162
script_usage
163+
echo
164+
echo "Examples:"
165+
flows_examples
161166
}
162167

163168
function packets_usage {
164169
echo
165-
echo "Netobserv allows you to capture packets from your cluster."
170+
echo "NetObserv allows you to capture packets from your cluster."
166171
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
167172
echo
168173
echo "Syntax: netobserv packets [options]"
169174
echo
170-
echo "filters:"
175+
echo "Filters:"
171176
filters_usage
172177
echo
173-
echo "options:"
178+
echo "Options:"
174179
flowsAndPackets_collector_usage
175180
script_usage
181+
echo
182+
echo "Examples:"
183+
packets_examples
176184
}
177185

178186
function metrics_usage {
179187
echo
180-
echo "Netobserv allows you to capture metrics on your OCP cluster."
188+
echo "NetObserv allows you to capture metrics on your OCP cluster."
181189
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
182190
echo
183191
echo "Syntax: netobserv metrics [options]"
184192
echo
185-
echo "features:"
193+
echo "Features:"
186194
features_usage
187195
echo
188-
echo "filters:"
196+
echo "Filters:"
189197
filters_usage
190198
flowsAndMetrics_filters_usage
191-
echo "options:"
199+
echo
200+
echo "Options:"
192201
metrics_collector_usage
193202
script_usage
194203
metrics_options
195204
echo
205+
echo "Examples:"
206+
metrics_examples
207+
echo
196208
echo "More information, with full list of available metrics: https://github.com/netobserv/network-observability-operator/blob/main/docs/Metrics.md"
197209
}
198210

199211
function follow_usage {
200212
echo
201-
echo "Netobserv allows you to capture flows and packets asyncronously using the --background option."
213+
echo "NetObserv allows you to capture flows and packets asyncronously using the --background option."
202214
echo "While the capture is running in background, you can connect to the collector pod to see the progression using the follow command."
203215
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
204216
echo
@@ -208,7 +220,7 @@ function follow_usage {
208220

209221
function stop_usage {
210222
echo
211-
echo "Netobserv allows you stop the collection and keep collector or dashboard for post analysis."
223+
echo "NetObserv allows you stop the collection and keep collector or dashboard for post analysis."
212224
echo "While the capture is running, use the stop command to remove the eBPF agents."
213225
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
214226
echo
@@ -218,7 +230,7 @@ function stop_usage {
218230

219231
function copy_usage {
220232
echo
221-
echo "Netobserv allows you copy locally the captured flows or packets from the collector pod."
233+
echo "NetObserv allows you copy locally the captured flows or packets from the collector pod."
222234
echo "While the collector is running, use the copy command to copy the output file(s)."
223235
echo "To avoid modifications during the copy, it's recommended to stop the capture"
224236
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
@@ -229,7 +241,7 @@ function copy_usage {
229241

230242
function cleanup_usage {
231243
echo
232-
echo "Netobserv may require manual cleanup in some cases such as after a background run or in case of failure."
244+
echo "NetObserv may require manual cleanup in some cases such as after a background run or in case of failure."
233245
echo "Use the cleanup command to remove all the netobserv CLI components."
234246
echo "Find more information at: https://github.com/netobserv/network-observability-cli/"
235247
echo

0 commit comments

Comments
 (0)