PortSampRate

Set/Display sflow port sampling rate

PortSampRate

Shortest form: psr.

Show or set the packet sampling rates (as used by sFlow) of ports. PortSAMp is the newer command that also sets where samples go.

Arguments are positional: an optional port bitmap (all ports if omitted; see Ports and port bitmaps), then optionally the ingress rate and the egress rate. A rate n samples on average one packet in n; 0 turns sampling off and 1 samples every packet. If you give an ingress rate you must also give an egress rate, otherwise it prints PortSampRate: Error: missing egress rate. Setting prints nothing on success.

Without rates it prints one line per port: the port name, then ingress: 1 out of <n> packets, or ingress: not sampling,, and the same for egress.

Showing is safe. Setting changes sampling behind SONiC’s back and conflicts with SONiC’s sFlow configuration.

Hardware-validated — Show sampling rates

drivshell> PortSampRate ce0-ce3
 ce0:        ingress: not sampling,  egress: not sampling,
 ce1:        ingress: not sampling,  egress: not sampling,
 ce2:        ingress: not sampling,  egress: not sampling,
 ce3:        ingress: not sampling,  egress: not sampling,

Unvalidated — Sample one in 1000 packets in each direction, then turn sampling off

drivshell> PortSampRate ce0 1000 1000
drivshell> PortSampRate ce0 0 0

Built-in help

Set/Display port sampling rate characteristics.
Parameters: <pbm> [ingress_rate] [egress_rate]
    IngressRate/EgressRate:
        On average, every 1/(ingress_rate|egress_rate) packets will be sampled.
        A rate of 0 indicates no sampling.
        A rate of 1 indicates all packets sampled.