src/collectors/ebpf.plugin/ebpfgo.plugin/integrations/ebpf_socket.md
Plugin: ebpf-go.plugin Module: socket
Monitor TCP and UDP function calls, bandwidth, errors, and connection counts. Data is exposed through the on-demand network-protocols function consumed by the network-viewer.
Attach kprobe or fentry/fexit trampolines to the kernel functions tcp_sendmsg, tcp_cleanup_rbuf, tcp_connect (IPv4 and IPv6), tcp_close, udp_sendmsg, and udp_recvmsg. Per-cycle deltas and byte counts are computed in userspace from the BPF map snapshots.
This collector is only supported on the following platforms:
This collector supports collecting metrics from multiple instances of this integration, including remote instances.
The plugin needs setuid because it loads data inside the kernel. Netdata sets the necessary permissions during installation.
The plugin checks kernel compilation flags (CONFIG_KPROBES, CONFIG_BPF, CONFIG_BPF_SYSCALL, CONFIG_BPF_JIT), presence of BTF files, and the configured object flavor to decide which eBPF program will be attached.
The default configuration for this integration does not impose any limits on data collection.
This thread adds overhead every time a monitored kernel TCP or UDP function is called. The estimated additional period of time is between 90-200ns per call on kernels that do not have BTF technology.
Check if your kernel was compiled with necessary options (CONFIG_KPROBES, CONFIG_BPF, CONFIG_BPF_SYSCALL, CONFIG_BPF_JIT) in /proc/config.gz or inside /boot/config file. Some cited names can be different according to the preferences of Linux distributions.
When you do not have options set, it is necessary to get the kernel source code from https://kernel.org or a kernel package from your distribution, this last is preferred. The kernel compilation has a well defined pattern, but distributions can deliver their configuration files
with different names.
Now follow steps:
initrd) if it is necessary.The socket option in section [ebpf programs] controls whether the module is loaded.
Per-module overrides (update every, maps per core, btf path, ebpf object flavor, pid table size, socket monitoring table size, udp connection table size) belong in ebpf.d/socket.conf.
| Option | Description | Default | Required |
|---|---|---|---|
| socket | Enable (yes) or disable (no) the socket monitoring module. | no | no |
| update every | Data collection frequency in seconds. | 10 | no |
| maps per core | When enabled (yes), the plugin allocates one BPF hash table per CPU core instead of a single shared table. Improves throughput on multi-core systems; ignored on kernels older than 4.15. | yes | no |
| btf path | Path to the directory containing BTF files used for CO-RE (Compile Once, Run Everywhere) loading. | /sys/kernel/btf | no |
| ebpf object flavor | Select the BPF object flavor. Available values are arena, buffer ring (also accepted as buffer), and legacy (also accepted as tracing). The collector falls back to the next available flavor when the requested one is not supported by the running kernel. | buffer | no |
| pid table size | Maximum number of PIDs tracked in the per-PID SHM segment shared with apps.plugin and cgroups.plugin. Increase on hosts with more than 32768 concurrent monitored processes. | 32768 | no |
| socket monitoring table size | Maximum number of connections tracked in the tbl_nd_socket BPF hash map (per-PID TCP/UDP bandwidth). Increase on hosts with many concurrent connections; each entry consumes kernel BPF map memory. | 16384 | no |
| udp connection table size | Maximum number of UDP connections tracked in the tbl_nv_udp BPF hash map. Increase on hosts with high UDP connection rates. | 4096 | no |
The configuration file name for this integration is ebpf.d.conf.
You can edit the configuration file using the edit-config script from the
Netdata config directory.
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config ebpf.d.conf
There are no configuration examples.
There are no alerts configured by default for this integration.
Metrics grouped by scope.
The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
This module attaches to kernel TCP/UDP functions and publishes host-level TCP/UDP activity
through the on-demand network-protocols function (FUNCTIONGLOBAL) consumed by the
network-viewer. Per-cgroup and per-service socket activity is exported through the
eBPFGo shared-memory path consumed by cgroups.plugin.
Migration note — Per-host and per-app charts published by prior versions of
ebpf.pluginare not republished. The following are permanently removed; use thenetwork-protocolsfunction in network-viewer as a replacement.Removed per-host charts:
ip.inbound_conn,ip.tcp_outbound_conn,ip.tcp_functions,ip.total_tcp_bandwidth,ip.tcp_error,ip.tcp_retransmit,ip.udp_functions,ip.total_udp_bandwidth,ip.udp_error.Removed per-app charts:
app.ebpf_call_tcp_v4_connection,app.ebpf_call_tcp_v6_connection,app.ebpf_sock_total_bandwidth,app.ebpf_call_tcp_sendmsg,app.ebpf_call_tcp_cleanup_rbuf,app.ebpf_call_tcp_retransmit,app.ebpf_call_udp_sendmsg,app.ebpf_call_udp_recvmsg.Configuration changes from
network.conf— Thenetwork.conffile has been replaced bysocket.conf. The following defaults changed silently:
maps per corechanged fromnotoyes. Per-core BPF maps use more memory but reduce contention on multi-core systems. To restore the previous behaviour addmaps per core = notosocket.conf.ebpf co-re tracingchanged fromprobe(kprobe/legacy BPF) totrampoline(auto-detected). To force kprobes addebpf co-re tracing = probetosocket.conf.- The
[network connections]and[service name]sections fromnetwork.confhave no equivalent insocket.confand are not read; any per-port service name overrides are lost.
network-protocols function columnsThe network-protocols function returns a table with one row per transport protocol and the
following columns:
| Column | Description |
|---|---|
| Transport | Protocol name (TCP or UDP) |
| Family | IP family (IPv4+IPv6 combined) |
| Received | Segments or datagrams received per second |
| Sent | Segments or datagrams sent per second |
| Errors | Send/receive errors per second |
| ConnActive | Active connections opened per second |
| ConnEstablished | Currently established connections |
| ConnPassive | Passive connections opened per second |
| ConnReset | Reset connections per second |
| SegsTotal | Total segments per second |
| SegsRetransmitted | Retransmitted segments per second |
| DatagramsNoPort | Datagrams with no destination port per second |
All data is delivered through the on-demand network-protocols function consumed by network-viewer; no traditional Netdata charts are published for this scope.
This scope has no labels.
Metrics:
| Metric | Dimensions | Unit |
|---|