Skip to content

Instantly share code, notes, and snippets.

@jcpowermac
Created August 6, 2025 19:27
Show Gist options
  • Select an option

  • Save jcpowermac/5dd560ab2939c4de0f7cb0a2451879ee to your computer and use it in GitHub Desktop.

Select an option

Save jcpowermac/5dd560ab2939c4de0f7cb0a2451879ee to your computer and use it in GitHub Desktop.
openshift 4.18 rhel 9.4 bcc tools

replace section of toptcp otherwise process names will not be shown

    if ipv4_throughput:
        print("%-7s %-25s %-21s %-21s %6s %6s" % ("PID", "COMM",
            "LADDR", "RADDR", "RX_KB", "TX_KB"))

    # output
    for k, (send_bytes, recv_bytes) in sorted(ipv4_throughput.items(),
                                              key=lambda kv: sum(kv[1]),
                                              reverse=True):
        print("%-7d %-25s %-21s %-21s %6d %6d" % (k.pid,
            k.name,
            k.laddr + ":" + str(k.lport),
            k.daddr + ":" + str(k.dport),
            int(recv_bytes / 1024), int(send_bytes / 1024)))
FROM registry.redhat.io/rhel9/support-tools:latest
RUN dnf install -y --disablerepo='*' --enablerepo=rhel-9-for-x86_64-baseos-rpms --enablerepo=rhel-9-for-x86_64-appstream-rpms --releasever=9.4 --allowerasing --nobest wget tcpdump vim bind-utils sysstat procps-ng ncurses curl wget tcpdump vim iproute -y
RUN dnf install --disablerepo='*' --enablerepo=rhel-9-for-x86_64-baseos-eus-rpms --enablerepo=rhel-9-for-x86_64-appstream-eus-rpms --releasever=9.4 kernel-core-5.14.0-427.68.2.el9_4.x86_64 kernel-headers-5.14.0-427.68.2.el9_4.x86_64 -y
RUN dnf install --disablerepo='*' --enablerepo=rhel-9-for-x86_64-baseos-eus-rpms --enablerepo=rhel-9-for-x86_64-appstream-eus-rpms --releasever=9.4 --allowerasing --nobest bpftrace bpftool -y
COPY tcptop /root
RUN dnf clean all
sudo podman run \
-it \
--hostname toolbox \
--name "custom-bcc-toolbox" \
--privileged \
--net=host \
--pid=host \
--ipc=host \
--interactive \
--env HOST=/host \
--security-opt label=disable \
--volume /run:/run \
--volume /var/log:/var/log \
--volume /etc/machine-id:/etc/machine-id \
--volume /etc/localtime:/etc/localtime \
--volume /sys:/sys \
--volume /sys/kernel/debug:/sys/kernel/debug \
--volume /:/host \
quay.io/jcallen/bcc:latest /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment