-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a service to run a tcpdump during the run. This can be useful to capture various network traffic for post analysis. There didn't seem to quite be an appropriate place to document it, so a new debugging file is started, with some terse explaination of our various system-wide debugging services. Change-Id: I09aaa57611c5047d09a9bce7932d34e9d50b30e6
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
===================== | ||
System-wide debugging | ||
===================== | ||
|
||
A lot can go wrong during a devstack run, and there are a few inbuilt | ||
tools to help you. | ||
|
||
dstat | ||
----- | ||
|
||
Enable the ``dstat`` service to produce performance logs during the | ||
devstack run. These will be logged to the journal and also as a CSV | ||
file. | ||
|
||
memory_tracker | ||
-------------- | ||
|
||
The ``memory_tracker`` service periodically monitors RAM usage and | ||
provides consumption output when available memory is seen to be | ||
falling (i.e. processes are consuming memory). It also provides | ||
output showing locked (unswappable) memory. | ||
|
||
tcpdump | ||
------- | ||
|
||
Enable the ``tcpdump`` service to run a background tcpdump. You must | ||
set the ``TCPDUMP_ARGS`` variable to something suitable (there is no | ||
default). For example, to trace iSCSI communication during a job in | ||
the OpenStack gate and copy the result into the log output, you might | ||
use: | ||
|
||
.. code-block:: yaml | ||
job: | ||
name: devstack-job | ||
parent: devstack | ||
vars: | ||
devstack_services: | ||
tcpdump: true | ||
devstack_localrc: | ||
TCPDUMP_ARGS: "-i any tcp port 3260" | ||
zuul_copy_output: | ||
'{{ devstack_log_dir }}/tcpdump.pcap': logs | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# | ||
# lib/tcpdump | ||
# Functions to start and stop a tcpdump | ||
|
||
# Dependencies: | ||
# | ||
# - ``functions`` file | ||
|
||
# ``stack.sh`` calls the entry points in this order: | ||
# | ||
# - start_tcpdump | ||
# - stop_tcpdump | ||
|
||
# Save trace setting | ||
_XTRACE_TCPDUMP=$(set +o | grep xtrace) | ||
set +o xtrace | ||
|
||
TCPDUMP_OUTPUT=${TCPDUMP_OUTPUT:-$LOGDIR/tcpdump.pcap} | ||
|
||
# e.g. for iscsi | ||
# "-i any tcp port 3260" | ||
TCPDUMP_ARGS=${TCPDUMP_ARGS:-""} | ||
|
||
# start_tcpdump() - Start running processes | ||
function start_tcpdump { | ||
# Run a tcpdump with given arguments and save the packet capture | ||
if is_service_enabled tcpdump; then | ||
if [[ -z "${TCPDUMP_ARGS}" ]]; then | ||
die $LINENO "The tcpdump service requires TCPDUMP_ARGS to be set" | ||
fi | ||
touch ${TCPDUMP_OUTPUT} | ||
run_process tcpdump "/usr/sbin/tcpdump -w $TCPDUMP_OUTPUT $TCPDUMP_ARGS" root root | ||
fi | ||
} | ||
|
||
# stop_tcpdump() stop tcpdump process | ||
function stop_tcpdump { | ||
stop_process tcpdump | ||
} | ||
|
||
# Restore xtrace | ||
$_XTRACE_TCPDUMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters