从自定义命名的网卡采集网络数据

场景说明

创建业务集群后,平台监控默认只能识别网卡名称与 eth.*|en.*|wl.*|ww.* 等模式匹配的网卡。对于用户自定义命名的网卡,无法在监控页面查看网络流量数据。为解决此问题,平台支持修改相关资源参数,以手动采集网卡流量数据。

操作步骤

  1. 登录 global 集群的控制平面节点,并使用 kubectl 执行以下命令。

  2. 首先,查找 global 集群中与业务集群对应的 moduleinfo 资源名称:

    kubectl get moduleinfo | grep -E 'prometheus|victoriametrics'

    示例输出:

    global-6448ef7f7e5e3924c1629fad826372e7     global     prometheus          prometheus                          Running   v3.15.0-zz231204040711-9d1fc12474c2   v3.15.0-zz231204040711-9d1fc12474c2   v3.15.0-zz231204040711-9d1fc12474c2
    ovn-0954f21f0359720e8c115804376b3e7e        ovn        prometheus          prometheus                          Running   v3.15.0-zz231204040711-9d1fc12474c2   v3.15.0-zz231204040711-9d1fc12474c2   v3.15.0-zz231204040711-9d1fc12474c2
  3. 编辑业务集群的 moduleinfo 资源,将 ovn-0954f21f0359720e8c115804376b3e7e 替换为上一步获取的业务集群 moduleinfo 资源名称:

    kubectl edit moduleinfo ovn-0954f21f0359720e8c115804376b3e7e
  4. 添加 valuesOverride 字段,并根据注释信息修改字段和正则表达式:

    spec:
      valuesOverride: # If this field does not exist, you need to add the valuesOverride field and the following parameters under spec
        ait/chart-cpaas-monitor:
          ovn: # Replace with the workload cluster name
            indicator:
              networkDevice: eth.*|em.*|en.*|wl.*|ww.*|[A-Z].*i|custom_interface # Replace custom_interface with a custom regular expression to ensure correct network card name matching
  5. 等待 10 分钟,然后检查节点监控页面上的网络相关图表,确保更改生效。