ss2 - Socket Statistics 2 (pyroute2)

Read in 2 min.

Gist


Disseminating a complementary and viably a more modern alternative to the established ss utility shipped with the well-known iproute package.

How to attain ss2?

It's part of the pyroute2 package install routines, so please follow those upstream to allow me to reduce redundancy in this regard.

Example Run

ss2 is offering, amongst many output formats, machine readable dumps of the kernel socket statistics. For it's renowned merits, json was chosen as the foremost default dumping format.

Mission is to proffer to the user of it everything the kernel can actually export as context to sockets.

Currently, as it is in its infancy, so not all aspects provided by ss have been implemented yet.

# ss2 --help

 usage: ss2 [-h] [-x] [-t] [-l] [-a] [-p] [-r]ss2 - socket statistics depictor meant as a complete and convenient surrogate 
 for iproute2/misc/ss2optional arguments: 
 -h, --help show this help message and exit 
 -x, --unix Display Unix domain sockets. 
 -t, --tcp Display TCP sockets. 
 -l, --listen Display listening sockets. 
 -a, --all Display all sockets. 
 -p, --process show socket holding context 
 -r, --resolve resolve host names in addition 

On a recent kernel (4.17.19-200.fc28.x86_64), following schema could be expected for TCP flows:

# ss2 -t
{  
    "TCP": {  
        "flows": [  
            {  
                "src": "10.0.2.15",  
                "src_port": 43332,  
                "retrans": 0,  
                "dst": "172.25.136.144",  
                "cong_algo": "cubic",  
                "dst_port": 22,  
                "meminfo": {  
                    "r": 0,  
                    "t": 0,  
                    "w": 0,  
                    "f": 4096  
                },  
                "iface_idx": 0,  
                "inode": 45433,  
                "tcp_info": {  
                    "delivery_rate": 5615384,  
                    "retrans": 0,  
                    "data_segs_in": 19,  
                    "rto": 201.0,  
                    "segs_in": 35,  
                    "rtt": 0.943,  
                    "retransmits": 0,  
                    "bytes_received": 5349,  
                    "last_ack_sent": 0,  
                    "rcv_space": 29200,  
                    "rcv_mss": 1420,  
                    "max_pacing_rate": 18446744073709551615,  
                    "ca_state": 0,  
                    "min_rtt": 260,  
                    "segs_out": 26,  
                    "advmss": 1460,  
                    "state": "established",  
                    "last_ack_recv": 113749,  
                    "snd_wscale": 0,  
                    "pmtu": 1500,  
                    "busy_time": 8000,  
                    "bytes_acked": 5630,  
                    "rcv_ssthresh": 49800,  
                    "total_retrans": 0,  
                    "last_data_recv": 113749,  
                    "unacked": 0,  
                    "fackets": 0,  
                    "sndbuf_limited": 0,  
                    "sacked": 0,  
                    "reordering": 3,  
                    "pacing_rate": 30944495,  
                    "rttvar": 0.859,  
                    "snd_cwnd": 10,  
                    "last_data_sent": 113995,  
                    "null": 0,  
                    "rcv_wscale": 0,  
                    "probes": 0,  
                    "notsent_bytes": 0,  
                    "data_segs_out": 15,  
                    "snd_ssthresh": null,  
                    "lost": 0,  
                    "ato": 40.0,  
                    "rwnd_limited": 0,  
                    "rcv_rtt": 0.0,  
                    "delivery_rate_app_limited": 1,  
                    "snd_mss": 1460,  
                    "opts": []  
                }  
            }  
        ]  
    }  
}  
Category
Tagcloud
operations interpretation transmitting wan networks testbed cable to sky TX hint skb HAP flowing engineering tc tcp rmem ethtool bandwith product driver queues scaling KVM/Qemu satellites up/down link backbone internet transmission queues airborne networking stack config airborne internet backbone optics tcp wmem genbackupdata queuing discipline system operations rsync cp flowing Traffic Control traffic flows transeive window scaling congestion control theory queueing resource usage sending socket radio links transmit packet steering ibvirt FSO links egress data migration user land core emulator bottle-neck utility perf json flow grouping msi XPS net traversal NAPI comparison data series explanation machine readable wireless suite c-ISP future backbones ss cwnd speed of light stack traversal global backbone network high altitude platform vs Monitoring laser communication mechanism introspection network paths nfs space-to-earth-link trouble shooting virt-builder flent nic driver flows automation metrics airship softirq ebpf fibre backbone analysis bcc traffic volume multi queueing correlation internet engineering atmospheric mitigation techniques tcp python tcp/ip statistics linux engineering tool qdisc kernel research networking tcp flows Tuning performance linux network stack