From: Jay Vosburgh <jv@jvosburgh.net>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: dave seddon <dave.seddon.ca@gmail.com>, netdev@vger.kernel.org
Subject: Re: tcp_diag for all network namespaces?
Date: Tue, 10 Dec 2024 12:45:22 -0800 [thread overview]
Message-ID: <1373213.1733863522@famine> (raw)
In-Reply-To: <Z1fO0rT9MZs5D61z@pop-os.localdomain>
Cong Wang <xiyou.wangcong@gmail.com> wrote:
>On Mon, Dec 09, 2024 at 11:24:18AM -0800, dave seddon wrote:
>> G'day,
>>
>> Short
>> Is there a way to extract tcp_diag socket data for all sockets from
>> all network name spaces please?
>>
>> Background
>> I've been using tcp_diag to dump out TCP socket performance every
>> minute and then stream the data via Kafka and then into a Clickhouse
>> database. This is awesome for socket performance monitoring.
>>
>> Kubernetes
>> I'd like to adapt this solution to <somehow> allow monitoring of
>> kubernetes clusters, so that it would be possible to monitor the
>> socket performance of all pods. Ideally, a single process could open
>> a netlink socket into each network namespace, but currently that isn't
>> possible.
>>
>> Would it be crazy to add a new feature to the kernel to allow dumping
>> all sockets from all name spaces?
>
>You are already able to do so in user-space, something like:
>
>for ns in $(ip netns list | cut -d' ' -f1); do
> ip netns exec $ns ss -tapn
>done
>
>(If you use API, you can find equivalent API's)
FWIW, if any namespaces weren't created through /sbin/ip, then
something like the following works as well:
#!/bin/bash
nspidlist=`lsns -t net -o pid -n`
for p in ${nspidlist}; do
lsns -p ${p} -t net
nsenter -n -t ${p} ss -tapn
done
-J
---
-Jay Vosburgh, jv@jvosburgh.net
next prev parent reply other threads:[~2024-12-10 20:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 19:24 tcp_diag for all network namespaces? dave seddon
2024-12-10 2:00 ` Kuniyuki Iwashima
2024-12-19 18:11 ` Martin KaFai Lau
2024-12-10 5:17 ` Cong Wang
2024-12-10 20:45 ` Jay Vosburgh [this message]
2024-12-11 6:35 ` Xiao Liang
2024-12-11 17:28 ` Cong Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373213.1733863522@famine \
--to=jv@jvosburgh.net \
--cc=dave.seddon.ca@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).