Configure the Packet Sampling Rate

Configure the packet sampling rate at port level to determine how many packets the system counts before it takes a sample. Configuring the sampling rate enables sFlow on the port.

Before you begin

  • You must globally enable sFlow.

About this task

If you configure a conservative sampling rate to prevent overloading the sFlow agent, the result will reflect high values that do not reflect typical traffic levels.

Procedure

  1. Enter GigabitEthernet Interface Configuration mode:

    enable

    configure terminal

    interface GigabitEthernet {slot/port[/sub-port][-slot/port[/sub-port]][,...]}

    Note

    Note

    If the platform supports channelization and the port is channelized, you must also specify the sub-port in the format slot/port/sub-port.

  2. Configure the collector id:

    sflow collector <1–2>

  3. Configure the sampling rate:

    sflow sampling-rate <1024–1000000>

  4. Verify the configuration:

    show sflow interface {slot/port[/sub-port] [-slot/port[/sub-port]] [,...]}

Example

Configure sampling rates for ports 2/1, 2/2, 2/3, and 2/4.

Switch:1(config-if)#interface gigabitethernet 2/1,2/2
Switch:1(config-if)#sflow collector 1
Switch:1(config-if)#sflow sampling-rate 10000
Switch:1(config-if)#interface gigabitethernet 2/3
Switch:1(config-if)#sflow collector 2
Switch:1(config-if)#sflow sampling-rate 8192
Switch:1(config-if)#interface gigabitethernet 2/4
Switch:1(config-if)#sflow collector 2
Switch:1(config-if)#sflow sampling-rate 12001
Switch:1(config-if)#show sflow interface enabled
=============================================================================
                         sFlow Port Configuration Info

=============================================================================
Port   Packet-Sample-Rate  Max-Header-Size Counter-interval  Collector-list
                                           (in secs)
-----------------------------------------------------------------------------
2/1    10000               128             0                 1
2/2    10000               128             0                 1
2/3    8192                128             0                 2
2/4    12001               128             0                 2
-----------------------------------------------------------------------------

All 4 out of 4 Total Num of sflow port entries displayed

Variable Definitions

Use the data in the following table to use the sflow sampling-rate and show sflow interface commands.

Variable

Value

<1024–1000000>

Configures the packet sampling rate on a port.

The default value is 0 (disabled). To configure the default value, enter default sflow sampling-rate.

{slot/port[/sub-port] [-slot/port[/sub-port]] [,...]}

Identifies the slot and port in one of the following formats: a single slot and port (slot/port), a range of slots and ports (slot/port-slot/port), or a series of slots and ports (slot/port,slot/port,slot/port). If the platform supports channelization and the port is channelized, you must also specify the sub-port in the format slot/port/sub-port.