sFlow Commands

This chapter contains the following sections:

sflow receiver

To define the sFlow collector, use the sflow receiver Global Configuration mode command. To remove the definition of the collector, use the no form of this command.

Syntax

sflow receiver index {ipv4-address | ipv6-address | hostname} [port port] [max-datagram-size bytes]

no sflow receiver index

Parameters

  • index—The index of the receiver. (Range: 1–8)

  • ipv4-address—IPv4 address of the host to be used as an sFlow Collector.

  • ipv6-address—IPv6 address of the host to be used as an sFlow Collector. When the IPv6 address is a Link Local address (IPv6Z address), the outgoing interface name must be specified. Refer to the User Guidelines for the interface name syntax.

  • hostname—Hostname of the host to be used as an sFlow Collector.

  • port—(Optional) Port number for sflow messages. If unspecified, the port number defaults to 6343. The range is 1-65535.

  • bytes—(Optional) Specifies the maximum datagramsize that can be sent. If unspecified, it defaults to 1400.

Default

No receiver is defined.

Command Mode

Global Configuration mode

User Guidelines

If the IP address of the sFlow receiver is set to 0.0.0.0, no sFlow datagrams are sent.

sflow flow-sampling

To enable sFlow Flow sampling and configure the average sampling rate of a specific port, use the sflow flow-sampling Interface Configuration mode command. To disable Flow sampling, use the no form of this command.

Syntax

sflow flow-sampling rate receiver-index [max-header-size bytes]

no sflow flow-sampling

Parameters

rate—Specifies the average sampling rate. The sampling rate is calculated as 1/rate (Range: 1024–1073741823.)

receiver-index—Index of the receiver/collector (Range: 1–8.)

bytes—(Optional) Specifies the maximum number of bytes that would be copied from the sampled packet. If unspecified, defaults to 128. (Range: 20–256.)

Default

Disabled

Command Mode

Interface Configuration mode

User Guidelines

A new sampling rate configuration is not immediately loaded to the hardware. It will be loaded to the hardware only after the next packet is sampled (based on the current sampling rate).

sflow counters-sampling

To enable sFlow Counters sampling and to configure the maximum interval of a specific port, use the sflow counters-sampling Interface Configuration mode command . To disable sFlow Counters sampling, use the no form of this command.

Syntax

sflow counters-sampling interval receiver-index

no sflow counters-sampling

Parameters

interval—Specifies the maximum number of seconds between successive samples of the interface counters. (Range: 15–86400.)

receiver-index—Index of the receiver/collector. (Range: 1–8.)

Default

Disabled

Command Mode

Interface Configuration mode

clear sflow statistics

To clear sFlow statistics, use the clear sFlow statistics Privileged EXEC mode command.

Syntax

clear sflow statistics [interface-id]

Parameters

interface-id—(Optional) Specifies an interface ID. The interface ID must be an Ethernet port.

Command Mode

Privileged EXEC mode

User Guidelines

If no interface is specified by the user, the command clears all the sFlow statistics counters (including datagrams sent). If an interface is specified by the user, the command clears only the counter of the specific interface.

show sflow configuration

To display the sFlow configuration for ports that are enabled for Flow sampling or Counters sampling, use the show sflow configuration Privileged EXEC mode command.

Syntax

show sflow configuration [interface-id]

Parameters

interface-id—(Optional) Specifies an interface ID. The interface ID must be an Ethernet port.

Command Mode

Privileged EXEC mode

Example

switchxxxxxx#  show sflow configuration
sFlow Agent Address 172.16.1.1
Receivers
Index      IP Address        Port   Max Datagram Size
----- -------------------- -------- ----------------
  1         0.0.0.0          6343         1400
  2         172.16.1.2       6343         1400
  3         0.0.0.0          6343         1400
  4         0.0.0.0          6343         1400
  5         0.0.0.0          6343         1400
  6         0.0.0.0          6343         1400
  7         0.0.0.0          6343         1400
  8         0.0.0.0          6343         1400
Interfaces
Inter-  Flow          Counters  Max Header  Flow      Counters Collector
face    Sampling      Sampling  Size        Collector Index    Index
----- -----------     --------- ---------   ---------- -----   ------------
gi1/0/1   1/2048     60 sec    128         1                  1
gi1/0/2   1/4096     Disabled  128         0                  2
Global values
--------------
Source IPv4 interface: vlan 120
Source IPv6 interface: vlan 10

sflow receiver source-interface

Use the sflow receiver source-interface Global Configuration mode command to specify the source interface whose IPv4 address will be used as the Source IPv4 address for communication with sFlow receivers. Use the no form of this command to restore the default configuration.

Syntax

sflow receiver source-interface interface-id

no sflow receiver source-interface

Parameters

  • interface-id—Specifies the source interface.

Default Configuration

The source IPv4 address is the IPv4 address defined on the outgoing interface and belonging to next hop IPv4 subnet.

Command Mode

Global Configuration mode

User Guidelines

If the source interface is the outgoing interface, the interface IP address belonging to next hop IPv4 subnet is applied.

If the source interface is not the outgoing interface, the minimal IPv4 address defined on the source interface is applied.

If there is no available IPv4 source address, a SYSLOG message is issued when attempting to communicate with an IPv4 sFlow server.

Example

The following example configures the VLAN 10 as the source interface.

switchxxxxxx(config)# sflow receiver source-interface vlan 100

sflow receiver source-interface-ipv6

Use the sflow receiver source-interface-ipv6 Global Configuration mode command to specify the source interface whose IPv6 address will be used as the source IPv6 address for communication with IPv6 sFlow receivers. Use the no form of this command to restore the default configuration.

Syntax

sflow receiver source-interface-ipv6 interface-id

no sflow receiver source-interface-ipv6

Parameters

  • interface-id—Specifies the source interface.

Default Configuration

The IPv6 source address is the IPv6 address defined on the outgoing interface and selected in accordance with RFC6724.

Command Mode

Global Configuration mode

User Guidelines

If the source interface is the outgoing interface, the source IPv6 address is an IPv6 address defined on the interfaces and selected in accordance with RFC 6724.

If the source interface is not the outgoing interface, the source IPv6 address is the minimal IPv6 address defined on the source interface and matched to the scope of the destination IPv6 address is applied.

If there is no available source IPv6 address, a SYSLOG message is issued when attempting to communicate with an IPv6 sFlow receiver.

Example

The following example configures the VLAN 10 as the source interface.

switchxxxxxx(config)# sflow receiver source-interface-ipv6 vlan 100