NVIDIA Onyx User Manual v3.10.2002
NVIDIA MLNX-GW User Manual for NVIDIA Skyway Appliance v8.2.2200

sFlow

sFlow (ver. 5) is a procedure for statistical monitoring of traffic in networks.NVIDIA Onyx supports an sFlow sampling mechanism (agent), which includes collecting traffic samples and data from counters. The sFlow datagrams are then sent to a central collector.

The sampling mechanism must ensure that any packet going into the system has an equal chance of being sampled, irrespective of the flow to which it belongs. The sampling mechanism provides the collector with periodical information on the amount (and load) of traffic per interface by loading the counter samples into sFlow datagrams.

The sFlow packets are encapsulated and sent in UDP over IP. The UDP port number that is used is the standard 6343 by default.

images/networking/download/attachments/80577465/sFlow.bmp

The sFlow agent samples the data path based on packets.

Truncation and sampling rate are the two parameters that influence the flow samples. In case of congestion the flow samples can be truncated to a predefined size before it is assigned to the CPU. The truncation can be set to any value between 64 to 256 bytes with the default being 128 bytes.

The sampling rate can be adjusted by setting an average rate. The system assures that a random number of packets is sampled, however, the sample rate on average converges to the configured rate. Valid values range between 4000 to 16777215 packets.

The sFlow sends flow samples using an expanded flow sample format.

The sFlow agent samples interface counters time based. Polling interval is configurable to any value between 5-3600 seconds with the default being 20 seconds.

The sFlow sends statistical samples using an expanded counter sample format.

The following statistics are gathered by the CPU:

Counter

Description

Total packets

The number of packets that pass through sFlow-enabled ports

Number of flow samples

The number of packets that are captured by the sampling mechanism

Number of statistic samples

The number of statistical samples

Number of discarded samples

The number of samples that were discarded

Number of datagrams

The number of datagrams that were sent to the collector

The sFlow datagrams contain flow samples and statistical samples.

The sFlow mechanism uses IP protocol, therefore if the packet length is more than the interface MTU, it becomes fragmented by the IP stack. The MTU may also be set manually to anything in the range of 200-9216 bytes. The default is 1400 bytes.

sFlow must be enabled on physical or LAG interfaces that require sampling. When adding a port to a LAG, sFlow must be disabled on the port. If a port with enabled sFlow is configured to be added to a LAG, the configuration is rejected. Removing a port from a LAG disables sFlow on the port regardless of the LAG’s sFlow status.

  1. Unlock the sFlow commands.

    Copy
    Copied!
                

    switch (config) # protocol sflow

  2. Enable sFlow on the system.

    Copy
    Copied!
                

    switch (config) # sflow enable

  3. Enter sFlow configuration mode.

    Copy
    Copied!
                

    switch (config) # sflow switch (config sflow) #

  4. Set the central collector’s IP.

    Copy
    Copied!
                

    switch (config sflow) # collector-ip 10.10.10.10

  5. Set the agent-ip used in the sFlow header.

    Copy
    Copied!
                

    switch (config sflow) # agent-ip 20.20.20.20

  6. (Optional) Set the sampling rate of the mechanism.

    Copy
    Copied!
                

    switch (config sflow) # sampling-rate 16000

    Warning

    This means that one every 16000 packet gets collected for sampling.

  7. (Optional) Set the maximum size of the data path sample.

    Copy
    Copied!
                

    switch (config sflow) # max-sample-size 156

  8. (Optional) Set the frequency in which counters are polled.

    Copy
    Copied!
                

    switch (config sflow) # counter-poll-interval 19

  9. (Optional) Set the maximum size of the datagrams sent to the central collector.

    Copy
    Copied!
                

    switch (config sflow) # max-datagram-size 1500

  10. Enable the sFlow agent on the desired interfaces.

    Copy
    Copied!
                

    switch (config interface ethernet 1/1)# sflow enable switch (config interface port-channel 1)# sflow enable

To verify the attributes of the sFlow agent:

Copy
Copied!
            

switch (config)# show sflow sflow protocol: enabled sflow: enabled sampling-rate: 16000 max-sampled-size: 156 counter-poll-interval: 19 max-datagram-size: 1500 collector-ip: 10.10.10.10 collector-port: 6343 agent-ip: 20.20.20.20   ingress ports: Interfaces: Ethernet: eth1/1 Port-channel: po1   Statistics: Total Samples: 2000 Number of flow samples: 1200 Estimated Number of flow discarded: 0 Number of statistic samples: 800 Number of datagrams: 300

For more information about this feature and its potential applications, please refer to the following community post:

protocol sflow

protocol sflow
no protocol sflow

Unhides the sFlow commands.
The no form of the command deletes sFlow configuration and hides the sFlow commands.

Syntax Description

N/A

Default

Disabled

Configuration Mode

config

History

3.3.3500

Example

switch (config) # protocol sflow

Related Commands

Notes

sflow enable (global)

sflow enable
no sflow enable

Enables sFlow in the system.
The no form of the command disables sFlow without deleting the configuration.

Syntax Description

N/A

Default

Disabled

Configuration Mode

config

History

3.3.3500

Example

switch (config) # sflow enable

Related Commands

Notes

sflow

sflow

Enters sFlow configuration mode.

Syntax Description

N/A

Default

N/A

Configuration Mode

config

History

3.3.3500

Example

switch (config) # sflow
switch (config sflow) #

Related Commands

Notes

sampling-rate

sampling-rate <rate>
no sampling-rate

Configures sFlow sampling ratio.
The no form of the command resets this parameter to its default value.

Syntax Description

rate

Configures the number of packets passed before selecting one for sampling
Range: 4000-16777215
“0” disables sampling

Default

N/A

Configuration Mode

config

History

3.3.3500

Example

switch (config) # protocol sflow

Related Commands

Notes

max-sample-size

max-sample-size <packet-size>
no max-sample-size

Configures the maximum size of sampled packets by sFlow.
The no form of the command resets the parameter to its default value.

Syntax Description

packet-size

The sampled packet size
Range: 64-256 bytes

Default

N/A

Configuration Mode

config

History

3.3.3500

Example

switch (config sflow) # max-sample-size 165

Related Commands

Notes

Sampled payload beyond the configured size is discarded

counter-poll-interval

counter-poll-interval <seconds>
no counter-poll-interval

Configures the sFlow statistics polling interval.
The no form of the command resets the parameter to its default value.

Syntax Description

seconds

The sFlow statistics polling interval in seconds
Range: 5-3600 seconds; “0” disables the statistic polling

Default

20 seconds

Configuration Mode

config

History

3.3.3500

Example

switch (config sflow) # counter-poll-interval 30

Related Commands

Notes

max-datagram-size

max-datagram-size <packet-size>
no max-datagram-size

Configures the maximum sFlow packet size to be sent to the collector.
The no form of the command resets the parameter to its default value.

Syntax Description

packet-size

The packet size of the packet being sent to the collector
Range: 200-9216 bytes

Default

1400 bytes

Configuration Mode

config

History

3.3.3500

Example

switch (config sflow) # max-datagram-size 9216

Related Commands

Notes

This packet contains the data sample as well as the statistical counter data

collector-ip

collector-ip <ip-address> [udp-port <udp-port-number>]
no collector-ip [<ip-address> udp-port]

Configures the collector’s IP.
The no form of the command resets the parameters to their default values.

Syntax Description

ip-address

The collector IP address

udp-port

Configures the collector UDP port number

Default

ip-address: 0.0.0.0
udf-port-number: 6343

Configuration Mode

config

History

3.3.3500

Example

switch (config sflow) # collector-ip 10.10.10.10

Related Commands

Notes

agent-ip

agent-ip {<ip-address> | interface [ethernet <slot/port> | port-channel <channel-group>] | <if-name> | loopback <number> | vlan <id>}
no agent-ip

Configures the IP address associated with this agent.
The no form of the command resets the parameters to their default values.

Syntax Description

interface

Configures a specific Ethernet/LAG interface’s agent IP

if-name

Interface name (e.g. mgmt0, mgmt1)

ip-address

The sFlow agent’s IP address (i.e. the source IP of the packet)

loopback

Loopback interface number
Range: 1-32

vlan

Interface VLAN
Range: 1-4094

Default

ip-address: 0.0.0.0

Configuration Mode

config

History

3.3.3500

3.3.5200

Updated “interface” parameters

Example

switch (config sflow) # agent-ip 20.20.20.20

Related Commands

Notes

The IP address here is used in the sFlow header

clear counters

clear counters

Clears sFlow counters.

Syntax Description

N/A

Default

N/A

Configuration Mode

config

History

3.3.3500

Example

switch (config sflow) # clear counters

Related Commands

Notes

sflow enable (interface)

sflow enable
no sflow enable

Enables sFlow on this interface.
The no form of the command disables sFlow on the interface.

Syntax Description

N/A

Default

disable
no view-port-channel member

Configuration Mode

config interface ethernet
config interface port-channel
config interface mlag-port-channel

History

3.3.3500

3.3.4500

Added MPO configuration mode

Example

switch (config interface ethernet 1/1)# sflow enable

Related Commands

Notes

show sflow

show sflow

Displays sFlow configuration and counters.

Syntax Description

N/A

Default

N/A

Configuration Mode

Any command mode

History

3.3.3500

3.6.3004

Updated example

3.6.6000

Updated example

3.9.2000

Updated example, adding VRF field

Example

switch (config)# show sflow
sflow protocol: enabled
sflow: enabled
VRF name: mgmt
sampling-rate: 16000
max-sample-size: 128
counter-poll-interval: 20
max-datagram-size: 1400
ip-agent: 0.0.0.0

ingress ports:
Interfaces:
Ethernet eth1/2 eth1/1

Statistics:
Total Samples: 0
Number of flow samples: 0
Estimated Number of flow discarded: 0
Number of flow statistics samples: 0
Number of datagrams: 0

Related Commands

Notes

© Copyright 2023, NVIDIA. Last updated on May 23, 2023.