- Table of Contents
-
- 21-Network Management and Monitoring Command Reference
- 00-Preface
- 01-Ping and tracert commands
- 02-System debugging commands
- 03-NQA commands
- 04-iNQA commands
- 05-NTP commands
- 06-SNMP commands
- 07-RMON commands
- 08-Event MIB commands
- 09-CWMP commands
- 10-Sampler commands
- 11-Mirroring commands
- 12-NetStream commands
- 13-IPv6 NetStream commands
- 14-Cloud connection commands
- 15-Packet capture commands
- 16-sFlow commands
- 17-IP traffic statistics collection commands
- Related Documents
-
Title | Size | Download |
---|---|---|
16-sFlow commands | 99.06 KB |
sFlow commands
sFlow is available only on the RT-MSU-400-G MPUs and RT-XMIM-8GEE-R/RT-XMIM-8GEF-R interface modules.
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
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 Dscp
1 22:2:20::10 6535 N/A 1400 netserver 1
2 192.168.3.5 6543 500 1400 Office 0
Port counter sampling information:
Interface Instance CID Interval(s)
GE1/0/1 2 2 100
GE1/0/1 1 1 200
Port flow sampling information:
Interface Instance FID MaxHLen Rate Mode Status
GE1/0/1 2 2 128 1000 Determine Active
GE1/0/1 1 1 128 1000 DetermineActive
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. |
Dscp |
DSCP value of sFlow packets. |
Port counter sampling information |
Information about interfaces configured with counter sampling. |
Port flow sampling information |
Information about interfaces configured with flow sampling. |
Interface |
Interface configured with sFlow. |
Instance |
ID of the sFlow instance for sending counter or flow sampled packets. |
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. This field is not supported in the current software version. |
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 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 ip-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 IP address for the sFlow agent. It does not save the IP address in the configuration file.
Views
System view
Predefined user roles
network-admin
Parameters
ip ip-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 IPv4 address 10.10.10.1 for the sFlow agent.
<Sysname> system-view
[Sysname] sflow agent ip 10.10.10.1
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 ip-address | ipv6 ipv6-address } [ datagram-size size | description string | dscp dscp-value | port port-number | time-out seconds ] *
undo sflow collector collector-id
Default
No sFlow collector information is configured.
Views
System view
Predefined user roles
network-admin
Parameters
collector-id: Specifies an sFlow collector by its ID. The value range for this argument is 1 to 10.
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 ip-address: Specifies an IPv4 address for the sFlow collector.
ipv6 ipv6-address: Specifies an IPv6 address for the sFlow collector.
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.
description string: Specifies a description, a case-sensitive string of 1 to 127 characters. The default description is "CLI Collector."
dscp dscp-value: Specifies the DSCP value of sFlow packets, in the range of 0 to 63. The default is 0.
port port-number: Specifies the UDP port number of the sFlow collector, in the range of 1 to 65535. The default is 6343.
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.
Usage guidelines
The Differentiated Services Code Point (DSCP) value of an IP packet is carried in the ToS field of the packet. The DSCP value of a packet determines the transmission priority of the packet. A greater DSCP value represents a higher priority.
Examples
# Configure the following parameters for sFlow collector 2:
· IPv4 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 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 [ instance instance-id ] collector collector-id
undo sflow counter [ instance instance-id ] collector
Default
No sFlow instance or sFlow collector is specified for counter sampling.
Views
Layer 3 Ethernet interface view
Predefined user roles
network-admin
Parameters
instance instance-id: Specifies an sFlow instance by its ID in the range of 1 to 4. The default ID for an sFlow instance is 1. If you do not specify an sFlow instance, this command specifies sFlow instance 1 for counter sampling.
collector-id: Specifies an sFlow collector by its ID. The value range for this argument is 1 to 10.
Usage guidelines
This command enables the device to send counter sampling information on an interface to the specified sFlow collector.
On an interface, one sFlow instance has only one sFlow collector. To specify multiple sFlow collectors for counter sampling, execute this command multiple times and use different sFlow instances each time. If you execute this command multiple times but use the same sFlow instance and different sFlow collectors each time, the most recent configuration takes effect.
On an interface, counter sampling and flow sampling are separate from each other. They can have different sFlow collectors specified.
Settings of sFlow collectors for different interfaces do not affect each other. Configure this command based on actual requirement.
Examples
# Specify sFlow instance 2 and 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 instance 2 collector 2
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 3 Ethernet interface view
Predefined user roles
network-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 flow collector
Use sflow flow collector to specify an sFlow instance and an sFlow collector for flow sampling.
Use undo sflow flow collector to restore the default.
Syntax
sflow flow [ instance instance-id ] collector collector-id
undo sflow flow [ instance instance-id ] collector
Default
No sFlow instance or sFlow collector is specified for flow sampling.
Views
Layer 3 Ethernet interface view
Predefined user roles
network-admin
Parameters
instance instance-id: Specifies an sFlow instance by its ID in the range of 1 to 4. The default ID for an sFlow instance is 1. If you do not specify an sFlow instance, this command specifies sFlow instance 1 for flow sampling.
collector-id: Specifies an sFlow collector by its ID. The value range for this argument is 1 to 10.
Usage guidelines
This command enables the device to send flow sampling information on an interface to the specified sFlow collector.
On an interface, one sFlow instance has only one sFlow collector. To specify multiple sFlow collectors for flow sampling, execute this command multiple times and use different sFlow instances each time. If you execute this command multiple times but use the same sFlow instance and different sFlow collectors each time, the most recent configuration takes effect.
On an interface, counter sampling and flow sampling are separate from each other. They can have different sFlow collectors specified.
Settings of sFlow collectors for different interfaces do not affect each other. Configure this command based on actual requirement.
Examples
# Specify sFlow instance 2 and 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 instance 2 collector 2
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 3 Ethernet interface view
Predefined user roles
network-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 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
Default
Random sampling is used.
Views
Layer 3 Ethernet interface view
Predefined user roles
network-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.
|
NOTE: For flow sampling, this device supports only fixed sampling (determine) and does not support random sampling in the current software version. This document provides information about random sampling for theoretical study and reference only. Do not attempt to implement random sampling on this device. |
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 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 3 Ethernet interface view
Predefined user roles
network-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 is 1000 to 5000.
Examples
# Enable flow sampling to sample a packet out of 2048 packets on GigabitEthernet 1/0/1.
<Sysname> system-view
[Sysname] interface gigabitethernet 1/0/1
[Sysname-GigabitEthernet1/0/1] sflow sampling-rate 2048
Related commands
sflow sampling-mode
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 ip-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
Parameters
ip ip-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