5.87 BCC工具之tcpsubnet.py解读

一,工具简介

tcpsubnet工具根据目标子网统计吞吐量。

这个工具只在IPv4环境下工作,并允许用户指定特定的子网进行监控。通过使用tcpsubnet,用户可以实时地观察特定子网内TCP流量的变化和分布情况,从而帮助进行网络性能调优、故障排查和安全监控等工作。

二,代码示例

#!/usr/bin/env python

import argparse
import json
import logging
import struct
import socket
from bcc import BPF
from datetime import datetime as dt
from time import sleep

# 参数
examples = """examples:
    ./tcpsubnet                 # Trace TCP sent to the default subnets:
                                # 127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,
                                # 192.168.0.0/16,0.0.0.0/0
    ./tcpsubnet -f K            # Trace TCP sent to the default subnets
                                # aggregated in KBytes.
    ./tcpsubnet 10.80.0.0/24    # Trace TCP sent to 10.80.0.0/24 only
    ./tcpsubnet -J              # Format the output in JSON.
"""

default_subnets = "127.0.0.1/32,10.0.0.0/8,&

相关推荐

  1. 5.8 BCC工具mysqld_query.py解读

    2024-03-26 08:52:01       52 阅读
  2. 5.54 BCC工具dbstat.py解读

    2024-03-26 08:52:01       48 阅读
  3. 5.56 BCC工具funcslower.py解读

    2024-03-26 08:52:01       47 阅读
  4. 5.53 BCC工具dbslower.py解读

    2024-03-26 08:52:01       41 阅读
  5. 5.49 BCC工具rdmaucma.py解读

    2024-03-26 08:52:01       42 阅读
  6. 5.52 BCC工具dbslower.py解读

    2024-03-26 08:52:01       47 阅读
  7. 5.69 BCC工具runqlen.py解读

    2024-03-26 08:52:01       46 阅读
  8. 5.82 BCC工具tcpdrop.py解读

    2024-03-26 08:52:01       41 阅读
  9. 5.70 BCC工具runqslower.py解读

    2024-03-26 08:52:01       35 阅读
  10. 5.72 BCC工具wakeuptime.py解读

    2024-03-26 08:52:01       43 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-26 08:52:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-26 08:52:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-26 08:52:01       87 阅读
  4. Python语言-面向对象

    2024-03-26 08:52:01       96 阅读

热门阅读

  1. 卸载 kubeadm 方式安装的 k8s

    2024-03-26 08:52:01       44 阅读
  2. 机器学习——XGBoost算法

    2024-03-26 08:52:01       41 阅读
  3. 优化 - 排序算法

    2024-03-26 08:52:01       34 阅读
  4. 数据结构与算法-排序算法

    2024-03-26 08:52:01       38 阅读
  5. MD5加密

    MD5加密

    2024-03-26 08:52:01      32 阅读
  6. 【ES6】Set和Map数据结构

    2024-03-26 08:52:01       43 阅读
  7. SQL语言: 内外连接

    2024-03-26 08:52:01       39 阅读
  8. vue json字符串和Hex互转

    2024-03-26 08:52:01       39 阅读
  9. 蓝桥杯 付账问题

    2024-03-26 08:52:01       38 阅读