跳转至

Net


Net 采集器用于采集主机网络信息,如各网络接口的流量信息等。对于 Linux 将采集系统范围 TCP 和 UDP 统计信息。

配置

成功安装 DataKit 并启动后,会默认开启 Net 采集器,无需手动开启。

进入 DataKit 安装目录下的 conf.d/samples 目录,复制 net.conf.sample 并命名为 net.conf。示例如下:

[[inputs.net]]
  ## (optional) collect interval, default is 10 seconds
  interval = '10s'

  ## By default, gathers stats from any up interface, but Linux does not contain virtual interfaces.
  ## Setting interfaces using regular expressions will collect these expected interfaces.
  # interfaces = ['''eth[\w-]+''', '''lo''', ]

  ## Datakit does not collect network virtual interfaces under the linux system.
  ## Setting enable_virtual_interfaces to true will collect virtual interfaces stats for linux.
  # enable_virtual_interfaces = true

  ## On linux systems also collects protocol stats.
  ## Setting ignore_protocol_stats to true will skip reporting of protocol metrics.
  # ignore_protocol_stats = false

[inputs.net.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"

配置好后,重启 DataKit 即可。

可通过 ConfigMap 方式注入采集器配置配置 ENV_DATAKIT_INPUTS 开启采集器。

也支持以环境变量的方式修改配置参数(需要在 ENV_DEFAULT_ENABLED_INPUTS 中加为默认采集器):

  • ENV_INPUT_NET_INTERVAL

    采集器重复间隔时长

    字段类型: Duration

    采集器配置字段: interval

    默认值: 10s

  • ENV_INPUT_NET_IGNORE_PROTOCOL_STATS

    跳过协议度量的报告

    字段类型: Boolean

    采集器配置字段: ignore_protocol_stats

    默认值: false

  • ENV_INPUT_NET_ENABLE_VIRTUAL_INTERFACES

    采集 Linux 的虚拟网卡

    字段类型: Boolean

    采集器配置字段: enable_virtual_interfaces

    默认值: false

  • ENV_INPUT_NET_INTERFACES

    期望采集的网卡(正则)

    字段类型: List

    采集器配置字段: interfaces

    示例: eth[\w-]+,lo

  • ENV_INPUT_NET_TAGS

    自定义标签。如果配置文件有同名标签,将会覆盖它

    字段类型: Map

    采集器配置字段: tags

    示例: tag1=value1,tag2=value2

指标

以下所有数据采集,默认会追加名为 host 的全局 tag(tag 值为 DataKit 所在主机名),也可以在配置中通过 [inputs.net.tags] 指定其它标签:

[inputs.net.tags]
 # some_tag = "some_value"
 # more_tag = "some_other_value"
 # ...

net

Tags & Fields Description
host
(tag)
System hostname.
interface
(tag)
Network interface name.
bytes_recv Cumulative bytes received by the interface.
Type: int | (count)
Unit: digital,B
bytes_recv/sec The number of bytes received by the interface per second.
Type: int | (gauge)
Unit: traffic,B/S
bytes_sent Cumulative bytes sent by the interface.
Type: int | (count)
Unit: digital,B
bytes_sent/sec The number of bytes sent by the interface per second.
Type: int | (gauge)
Unit: traffic,B/S
drop_in Cumulative received packets dropped by the interface.
Type: int | (count)
Unit: count
drop_out Cumulative transmitted packets dropped by the interface.
Type: int | (count)
Unit: count
err_in Cumulative receive errors detected by the interface.
Type: int | (count)
Unit: count
err_out Cumulative transmit errors detected by the interface.
Type: int | (count)
Unit: count
packets_recv Cumulative packets received by the interface.
Type: int | (count)
Unit: count
packets_recv/sec The number of packets received by the interface per second.
Type: int | (gauge)
Unit: count
packets_sent Cumulative packets sent by the interface.
Type: int | (count)
Unit: count
packets_sent/sec The number of packets sent by the interface per second.
Type: int | (gauge)
Unit: count
tcp_activeopens Cumulative TCP active opens, where TCP sends SYN and enters SYN-SENT. Linux only
Type: int | (count)
Unit: count
tcp_attemptfails Cumulative failed TCP connection attempts as defined by TCP-MIB AttemptFails. Linux only
Type: int | (count)
Unit: count
tcp_currestab The number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT. Linux only
Type: int | (gauge)
Unit: count
tcp_estabresets Cumulative TCP connections that transitioned directly to CLOSED from ESTABLISHED or CLOSE-WAIT. Linux only
Type: int | (count)
Unit: count
tcp_incsumerrors Cumulative incoming TCP segments with checksum errors. Linux only
Type: int | (count)
Unit: count
tcp_inerrs Cumulative incoming TCP segments received in error. Linux only
Type: int | (count)
Unit: count
tcp_insegs Cumulative TCP segments received by the TCP layer. Linux only
Type: int | (count)
Unit: count
tcp_insegs/sec The number of packets received by the TCP layer per second. Linux only
Type: int | (gauge)
Unit: count
tcp_maxconn The limit on the total number of TCP connections the entity can support. Linux only
Type: int | (gauge)
Unit: count
tcp_outrsts Cumulative TCP segments sent containing the RST flag. Linux only
Type: int | (count)
Unit: count
tcp_outsegs Cumulative TCP segments sent by the TCP layer. Linux only
Type: int | (count)
Unit: count
tcp_outsegs/sec The number of packets sent by the TCP layer per second. Linux only
Type: int | (gauge)
Unit: count
tcp_passiveopens Cumulative TCP passive opens, where TCP receives SYN, replies SYN+ACK, and enters SYN-RCVD. Linux only
Type: int | (count)
Unit: count
tcp_retranssegs Cumulative TCP segments retransmitted with one or more previously transmitted octets. Linux only
Type: int | (count)
Unit: count
tcp_rtoalgorithm Algorithm identifier used to determine retransmission timeout values. Linux only
Type: int | (gauge)
Unit: N/A
tcp_rtomax The maximum value permitted by a TCP implementation for the retransmission timeout, measured in milliseconds. Linux only
Type: int | (gauge)
Unit: time,ms
tcp_rtomin The minimum value permitted by a TCP implementation for the retransmission timeout, measured in milliseconds. Linux only
Type: int | (gauge)
Unit: time,ms
udp_ignoredmulti Cumulative ignored UDP multicast packets. Linux only
Type: int | (count)
Unit: count
udp_incsumerrors Cumulative incoming UDP datagrams with checksum errors. Linux only
Type: int | (count)
Unit: count
udp_indatagrams Cumulative UDP datagrams delivered to UDP users. Linux only
Type: int | (count)
Unit: count
udp_indatagrams/sec The number of UDP datagram delivered to UDP users per second. Linux only
Type: int | (gauge)
Unit: count
udp_inerrors Cumulative UDP packet receive errors. Linux only
Type: int | (count)
Unit: count
udp_memerrors Cumulative UDP memory errors. Linux only
Type: int | (count)
Unit: count
udp_noports Cumulative UDP packets received for unknown ports. Linux only
Type: int | (count)
Unit: count
udp_outdatagrams Cumulative UDP datagrams sent from this entity. Linux only
Type: int | (count)
Unit: count
udp_outdatagrams/sec The number of UDP datagram sent from this entity per second. Linux only
Type: int | (gauge)
Unit: count
udp_rcvbuferrors Cumulative UDP receive buffer errors. Linux only
Type: int | (count)
Unit: count
udp_sndbuferrors Cumulative UDP send buffer errors. Linux only
Type: int | (count)
Unit: count

延伸阅读

文档评价

文档内容是否对您有帮助? ×