Socket Statistics Input Plugin
此插件使用 iproute2 的 ss 命令收集有关已建立网络连接的指标。ss 命令不需要特定权限。
此插件会产生高基数数据,如果不加以控制,将对数据库造成高负载。请务必过滤生成的指标或配置您的数据库以避免基数问题!
引入于: Telegraf v1.22.0 标签: network 操作系统支持: freebsd, linux, macos
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Gather indicators from established connections, using iproute2's ss command.
# This plugin ONLY supports non-Windows
[[inputs.socketstat]]
## ss can display information about tcp, udp, raw, unix, packet, dccp and sctp sockets
## Specify here the types you want to gather
protocols = [ "tcp", "udp" ]
## The default timeout of 1s for ss execution can be overridden here:
# timeout = "1s"Metrics
socketstat 测量包含以下字段
- state (string) (适用于 tcp, dccp 和 sctp 协议)
如果 ss 提供(取决于协议和 ss 版本),它还有以下附加字段
- bytes_acked (integer, bytes)
- bytes_received (integer, bytes)
- segs_out (integer, count)
- segs_in (integer, count)
- data_segs_out (integer, count)
- data_segs_in (integer, count)
所有测量值都有以下标签
- proto
- local_addr
- local_port
- remote_addr
- remote_port
示例输出
较新版本的 ss (这里是 iproute2 4.3.0)
./telegraf --config telegraf.conf --input-filter socketstat --testsocketstat,host=ubuntu-xenial,local_addr=10.6.231.226,local_port=42716,proto=tcp,remote_addr=192.168.2.21,remote_port=80 bytes_acked=184i,bytes_received=2624519595i,recv_q=4344i,segs_in=1812580i,segs_out=661642i,send_q=0i,state="ESTAB" 1606457205000000000较旧版本的 ss (这里是 iproute2 3.12.0)
./telegraf --config telegraf.conf --input-filter socketstat --testsocketstat,host=ubuntu-trusty,local_addr=10.6.231.163,local_port=35890,proto=tcp,remote_addr=192.168.2.21,remote_port=80 recv_q=0i,send_q=0i,state="ESTAB" 1606456977000000000此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。