Hi!
The topcontainers_net
in sysdig
is a chisel, a script that performs specific captures. Here is how chisels work in sysdig
.
The following command shows the available chisels in your installation of sysdig
.
sysdig --list-chisels
You can get the source code of a chisel (written in LUA) by looking in /usr/share/sysdig/chisels/
.
You can view the parameters of a chisel (for example, topprocs_net
) by running
$ sysdig --chisel-info topcontainers_net
Category: Net
-------------
topprocs_net Top processes by network I/O
Sort the list of the processes that use the most network bandwidth. This chisel
is compatible with containers using the sysdig -pc or -pcontainer argument, ot
herwise no container information will be shown.
Args:
(None)
That is, this chisel does not take any parameters. Let’s run it.
$ sudo sysdig --chisel topprocs_net
For your case, the migration of a LXD container is performed by LXD, and it is not a process that runs from within a container. Therefore, in this case you do not need to use/write a chisel that understands containers.
The LXD process that performs the migration should look (when you run ps
) like this:
11597 ? Ssl 0:00 /snap/lxd/current/bin/lxd forkmigrate ... ...
That is, the executable would be /snap/lxd/current/bin/lxd
and it would have as first parameter the keyword forkmigrate
. I have not verified this in practice, which means your first task is to start a migration and run ps
to verify that there is such a process running. Once you identify the process, you can start working on measuring the traffic.
You would need to write a chisel that
- identifies when a process is started that has the name
/snap/lxd/current/bin/lxd
and first argument forkmigrate
- starts counting the network packets of this process and performs the logic of your benchmark
There are a few relevant chisels in /usr/share/sysdig/chisels
that can help you. You can also check the documentation of sysdig
in writing chisels.