For reporting TCP ListenStats
, users of older Linux kernels need to ensure that the the "inet_diag" and "tcp_diag" kernel modules are loaded as they do not autoload correctly. The inet_diag facilities of Raindrops is useful for periodic snapshot reporting of listen queue sizes.
Instead of snapshotting, Raindrops::Aggregate::LastDataRecv
may be used to aggregate statistics from all
accepted sockets as they arrive based on the last_data_recv
field in Raindrops::TCP_Info
The standard proc path for active UNIX domain sockets, feel free to call String#replace on this if your /proc is mounted in a non-standard location for whatever reason
Raindrops::Linux.tcp_listener_stats([addrs[, sock]]) => hash source
If specified, addr
may be a string or array of strings representing listen addresses to filter for. Returns a hash with given addresses as keys and ListenStats
objects as the values or a hash of all addresses.
addrs = %w(0.0.0.0:80 127.0.0.1:8080)
If addr
is nil or not specified, all (IPv4) addresses are returned. If sock
is specified, it should be a Raindrops::InetDiagSock object.
unix_listener_stats (paths = nil) source
Get ListenStats
from an array of paths
Socket state mapping from integer => symbol, based on socket_state enum from include/linux/net.h in the Linux kernel:
typedef enum { SS_FREE = 0, /* not allocated */ SS_UNCONNECTED, /* unconnected to any socket */ SS_CONNECTING, /* in process of connecting */ SS_CONNECTED, /* connected to socket */ SS_DISCONNECTING /* in process of disconnecting */ } socket_state;
SS_CONNECTING maps to ListenStats#queued
SS_CONNECTED maps to ListenStats#active
This method may be significantly slower than its tcp_listener_stats
counterpart due to the latter being able to use inet_diag via netlink. This parses /proc/net/unix as there is no other (known) way to expose Unix domain socket statistics over netlink.
mail archives: https://yhbt.net/raindrops-public/ http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops-public nntps://news.public-inbox.org/inbox.comp.lang.ruby.raindrops nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops imaps://yhbt.net/inbox.comp.lang.ruby.raindrops.0 imap://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.raindrops.0 public: raindrops-public@yhbt.net source code: git clone https://yhbt.net/raindrops.git torsocks git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/raindrops.git