HowTo configure sFlow on Mellanox Switches

Version 12
    This post shows how to configure sFlow on Mellanox Ethernet switches.

     

    References

     

    sFlow (www.sflow.org) is an industry standard technology for monitoring high speed switched networks. It gives complete visibility into the use of networks enabling performance optimization, accounting/billing for usage, and defense against security threats.

    MLNX-OS supports sFlow (ver. 5) sampling mechanism (agent), which includes collecting traffic samples and counters from the switch.
    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.
    sFlow.bmp
    The sFlow agent samples the data path packet based. 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 being assigned to the CPU. The truncation can be set to any value between 64 to 256 bytes with the default being 128 bytes. Furthermore, the sampling rate may also be adjust as required.
     
    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 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.
    See here a nice video tutorial from Mellanox Academy, click here: sFlow

    To configure sFlow on MLNX-OS run the following commands:
    1. Enable sFlow globally on the switch:

    switch (config) # protocol sflow

    switch (config) # sflow enable

     

    2. Set the collector IP and the Agent IP.

    switch (config) # sflow agent-ip 10.10.10.10

    switch (config) # sflow collector-ip 10.10.10.11

     

    3. Enable sFlow on the required interface (physical interface or LAG)

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

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

     

    4. To tune other sFlow parameters you can use the following commands (optional)

    switch (config) # sflow sampling-rate <rate>

    switch (config) # sflow max-sample-size  <packet-size>

    switch (config) # sflow counter-poll-interval <seconds>

    switch (config) # sflow max-datagram-size <packet-size>

     

    5. To verify the sFlow configuration, simply run "show sflow" command

    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.11

    collector-port 6343

    agent-ip 10.10.10.10

    Interfaces

    Ethernet: eth1/1

    Port-channel: po1

    Statistics:

    Total Packets: 2000

    Number of flow samples: 1200

    Number of samples discarded: 0

    Number of statistic samples: 800

    Number of datagrams: 300

    switch (config)#

     

     

    As for the collector, there are different in the market. Here is an example of an output from sflowTrend (http://www.inmon.com/products/sFlowTrend.php)

    It is very easy to install and use.

     

    18.png

     

    18.png