sFlow commands -- display sflow

Use display sflow to display sFlow configuration and operation information.

Syntax

display sflow

Views

Any view

Predefined user roles

network-admin

network-operator

mdc-admin

mdc-operator

Examples

# Display sFlow configuration and operation information.

<Sysname> display sflow

sFlow datagram version: 5

Global information:

Agent IP: 10.10.10.1(CLI)

Source address: 10.0.0.1 2001::1

Collector information:

ID IP Port Aging Size VPN-instance Description

1 22:2:20::10 6535 N/A 1400 netserver

2 192.168.3.5 6543 500 1400 Office

Port information:

Interface CID Interval(s) FID MaxHLen Rate Mode Status

GE1/0/1 1 100 1 128 1000 Random Active

GE1/0/2 2 100 2 128 1000 Random Active

Table 1 Command output

Field | Description
sFlow datagram version | sFlow version, which can only take the value of 5. The device can send only sFlow packets whose sFlow version is 5.
Global information | Global sFlow information.
Agent IP | IP address of the sFlow agent: · CLI—Manually configured IP address. · Auto—Automatically configured IP address.
Source address | Source IP address of sFlow packets.
Collector information | sFlow collector information.
ID | sFlow collector ID.
IP | sFlow collector IP address.
Port | sFlow collector port.
Aging | Remaining lifetime of the sFlow collector. If this field displays N/A, the sFlow collector never ages out.
Size | Maximum length of the sFlow data portion in an sFlow packet.
VPN-instance | ‌ Name of the VPN instance to which the sFlow collector belongs.
Description | Description of the sFlow collector.
Port information | Information about interfaces configured with sFlow.
Interface | Interface configured with sFlow.
CID | ID of the sFlow collector for receiving counter sampled packets. If no sFlow collector ID is specified, this field displays 0.
Interval(s) | Counter sampling interval, in seconds.
FID | ID of the sFlow collector for receiving flow sampled packets. If no sFlow collector ID is specified, this field displays 0.
MaxHLen | Maximum number of bytes that can be copied in a sampled packet (starting from the packet header).
Rate | Number of packets out of which the interface samples a packet by using flow sampling.
Mode | Flow sampling mode: · Determine—Samples a fixed number of packets. · Random—Samples a random number of packets.
Status | sFlow status of the port: · Suspended—The sFlow feature is suspended because the port is down. · Active—The sFlow feature is active because the port is up.

‌

sFlow commands -- sflow agent

Use sflow agent to configure an IP address for the sFlow agent.

Use undo sflow agent to restore the default.

Syntax

sflow agent { ip ipv4-address | ipv6 ipv6-address }

undo sflow agent { ip | ipv6 }

Default

No IP address is configured for the sFlow agent. The device periodically identifies whether the sFlow agent has an IP address. If the sFlow agent does not have an IP address, the device automatically selects an IPv4 address for the sFlow agent. It does not save the IPv4 address in the configuration file.

Views

System view

Predefined user roles

network-admin

mdc-admin

Parameters

ip ipv4-address: Specifies an IPv4 address for the sFlow agent.

ipv6 ipv6-address: Specifies an IPv6 address for the sFlow agent.

Usage guidelines

As a best practice, manually configure an IP address for the sFlow agent.

If you execute this command multiple times, the most recent configuration takes effect.

Examples

# Specify IP address 10.10.10.1 for the sFlow agent.

<Sysname> system-view

[Sysname] sflow agent ip 10.10.10.1

sFlow commands -- sflow collector

Use sflow collector to configure parameters for an sFlow collector.

Use undo sflow collector to remove an sFlow collector.

Syntax

sflow collector collector-id [ vpn-instance vpn-instance-name ] { ip ipv4-address | ipv6 ipv6-address } [ port port-number ] [ datagram-size size ] [ time-out seconds ] [ description string ]

undo sflow collector collector-id

Default

No sFlow collector information is configured.

Views

System view

Predefined user roles

network-admin

mdc-admin

Parameters

collector-id: Specifies an sFlow collector by its ID. The value range for this argument varies by device model.

vpn-instance vpn-instance-name: Specifies an MPLS L3VPN instance to which the sFlow collector belongs. The vpn-instance-name argument represents the VPN instance name, a case-sensitive string of 1 to 31 characters. The VPN instance name cannot contain spaces. By default, the sFlow collector belongs to the public network.

ip ipv4-address: Specifies an IPv4 address for the sFlow collector.

ipv6 ipv6-address: Specifies an IPv6 address for the sFlow collector.

port port-number: Specifies the UDP port number of the sFlow collector, in the range of 1 to 65535. The default is 6343.

datagram-size size: Specifies the maximum length of the sFlow data portion in an sFlow packet. The value range for the size argument is 200 to 3000 bytes, and the default value is 1400 bytes.

time-out seconds: Specifies the aging timer of the sFlow collector, in the range of 1 to 2147483647 seconds. When the aging timer expires, the sFlow collector settings are deleted. The sFlow collector settings do not age out by default.

description string: Specifies a description, a case-sensitive string of 1 to 127 characters. The default description is "CLI Collector."

Examples

# Configure the following parameters for sFlow collector 2:

· IP address—3.3.3.1.

· Port number—Default.

· Description—netserver.

· Aging timer—1200 seconds.

· Maximum length of the sFlow data portion in the sFlow packet—1000 bytes.

<Sysname> system-view

[Sysname] sflow collector 2 ip 3.3.3.1 description netserver time-out 1200 datagram-size 1000

sFlow commands -- sflow counter collector

Use sflow counter collector to specify an sFlow collector for counter sampling.

Use undo sflow counter collector to restore the default.

Syntax

sflow counter collector collector-id

undo sflow counter collector

Default

No sFlow collector is specified for counter sampling.

Views

Layer 2 Ethernet interface view

Layer 3 Ethernet interface view

Predefined user roles

network-admin

mdc-admin

Parameters

collector-id: Specifies an sFlow collector by its ID. The value range for this argument varies by device model.

Examples

# Specify sFlow collector 2 on GigabitEthernet 1/0/1 for counter sampling.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] sflow counter collector 2

sFlow commands -- sflow counter interval

Use sflow counter interval to enable counter sampling and set a counter sampling interval.

Use undo sflow counter interval to disable counter sampling.

Syntax

sflow counter interval interval

undo sflow counter interval

Default

Counter sampling is disabled.

Views

Layer 2 Ethernet interface view

Layer 3 Ethernet interface view

Predefined user roles

network-admin

mdc-admin

Parameters

interval: Specifies the counter sampling interval in the range of 2 to 86400 seconds.

Examples

# Enable counter sampling and set the counter sampling interval to 120 seconds on GigabitEthernet 1/0/1.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] sflow counter interval 120

sFlow commands -- sflow flow collector

Use sflow flow collector to specify an sFlow collector for flow sampling.

Use undo sflow flow collector to restore the default.

Syntax

sflow flow collector collector-id

undo sflow flow collector

Default

No sFlow collector is specified for flow sampling.

Views

Layer 2 Ethernet interface view

Layer 3 Ethernet interface view

Predefined user roles

network-admin

mdc-admin

Parameters

collector-id: Specifies an sFlow collector by its ID. The value range for this argument varies by device model.

Examples

# Specify sFlow collector 2 on GigabitEthernet 1/0/1 for flow sampling.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] sflow flow collector 2

sFlow commands -- sflow flow max-header

Use sflow flow max-header to set the maximum number of bytes (starting from the packet header) that flow sampling can copy per packet.

Use undo sflow flow max-header to restore the default.

Syntax

sflow flow max-header length

undo sflow flow max-header

Default

Flow sampling can copy up to 128 bytes of a packet.

Views

Layer 2 Ethernet interface view

Layer 3 Ethernet interface view

Predefined user roles

network-admin

mdc-admin

Parameters

length: Specifies the maximum number of bytes that can be copied, in the range of 18 to 512. As a best practice, use the default value.

Examples

# Set the maximum number of bytes to 60 for flow sampling to copy per packet on GigabitEthernet 1/0/1.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] sflow flow max-header 60

sFlow commands -- sflow sampling-mode

Use sflow sampling-mode to specify a flow sampling mode.

Use undo sflow sampling-mode to restore the default.

Syntax

sflow sampling-mode { determine | random }

undo sflow sampling-mode

Views

Layer 2 Ethernet interface view

Layer 3 Ethernet interface view

Predefined user roles

network-admin

mdc-admin

Parameters

determine: Specifies the fixed sampling mode. For example, if the flow sampling interval is set to 4000 (by using the sflow sampling-rate command), the device samples packets as follows:

· The device randomly samples a packet, like the tenth packet, from the first 4000 packets.

· The next time the device samples the 4010th packet, and so on.

random: Specifies the random sampling mode. For example, if the packet sampling interval is set to 4000 (by using the sflow sampling-rate command), the device samples packets randomly as follows:

· The device might sample one packet from the first 4000 packets.

· The device might sample multiple packets from the next 4000 packets.

· The device might sample no packets from the third 4000 packets.

However, the device samples one packet from 4000 packets on average.

Examples

# Specify fixed flow sampling mode on GigabitEthernet 1/0/1.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] sflow sampling-mode determine

Related commands

sflow sampling-rate

sFlow commands -- sflow sampling-rate

Use sflow sampling-rate to enable flow sampling and specify the number of packets out of which flow sampling will sample a packet.

Use undo sflow sampling-rate to disable flow sampling.

Syntax

sflow sampling-rate rate

undo sflow sampling-rate

Default

Flow sampling is disabled.

Views

Layer 2 Ethernet interface view

Layer 3 Ethernet interface view

Predefined user roles

network-admin

mdc-admin

Parameters

rate: Specifies the number of packets out of which flow sampling will sample a packet on the interface. The value range for this argument varies by device model. As a best practice, set the sampling interval to 2n that is greater than or equal to 8192, for example, 32768.

Examples

# Enable flow sampling to sample a packet out of 32768 packets on GigabitEthernet 1/0/1.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] sflow sampling-rate 32768

Related commands

sflow sampling-mode

sFlow commands -- sflow source

Use sflow source to specify the source IP address of sent sFlow packets.

Use undo sflow source to restore the default.

Syntax

sflow source { ip ipv4-address | ipv6 ipv6-address } *

undo sflow source { ip | ipv6 } *

Default

The source IP address of sent sFlow packets is determined by routing.

Views

System view

Predefined user roles

network-admin

mdc-admin

Parameters

ip ipv4-address: Specifies the source IPv4 address of sent sFlow packets.

ipv6 ipv6-address: Specifies the source IPv6 address of sent sFlow packets.

Examples

# Specify the source IPv4 address of sent sFlow packets as 10.0.0.1.

<Sysname> system-view

[Sysname] sflow source ip 10.0.0.1