Example for Configuring the Bulk Statistics Collection Function
Networking Requirements
In the network shown in Figure 1-12, the switch is managed by an NMS. The switch uses SNMPv3 to communicate with the NMS, and data exchanged with the NMS is authenticated and encrypted to enhance security. The NMS sends SNMP request messages one by one in polling mode to obtain information from the switch, and the switch sends response messages one by one. As a result, a large number of messages are exchanged between the NMS and switch. These messages consume high bandwidth and many system resources on the switch.
Users want network devices to periodically send data of specified statistics objects to the NMS, using FTP as the primary transfer mode and TFTP as the secondary transfer mode.
Configuration Roadmap
To meet the preceding requirements, configure basic bulk statistics collection functions to enable the switch to periodically collect data of specified statistics objects, add collected data to a bulk file, and upload the file to the NMS through FTP or TFTP. Then configure upload attributes of the bulk file, including the upload interval, upload holding time, and maximum number of retransmissions.
The configuration roadmap is as follows:
Enable bulk statistics collection on the switch.
Create a bulk file and set attributes for it, including the statistics collection interval, upload interval, upload holding time, and primary upload URL.
Configure statistics objects for the bulk file.
Enable the bulk file.
Procedure
- Enable bulk statistics collection on the switch.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] bulk-stat enable
- Create a bulk file and set attributes for it, including the statistics collection interval, upload interval, upload holding time, and primary upload URL. In the FTP mode, the FTP user name, password, and IP address of the FTP server
need to be configured.
# Create a bulk file named file1, and set the statistics collection interval, upload interval, and upload holding time to 10 minutes. Set FTP as the primary transfer mode and TFTP as the secondary transfer mode and specify the upload URL.
[Switch] bulk-file file1 [Switch-bulk-file-file1] transfer interval 10 [Switch-bulk-file-file1] collect interval 10 [Switch-bulk-file-file1] transfer remain-time 10 [Switch-bulk-file-file1] transfer primary protocol ftp username user password pwd host 10.1.1.1 [Switch-bulk-file-file1] transfer secondary protocol tftp host 10.1.1.1 path folder/bulkstat2
- Configure statistics objects for the bulk file.
# Create a statistics object of the single type.
[Switch-bulk-file-file1] object 1.3.6.1.2.1.2.1.0 class single
# Create a statistics object of the column type.
[Switch-bulk-file-file1] object 1.3.6.1.2.1.2.2.1.4 class column
- Enable the bulk file.
[Switch-bulk-file-file1] collect enable [Switch-bulk-file-file1] quit
- Verify the configuration.
Before verifying the configuration, ensure that the FTP and TFTP services have been enabled on the server.
After the configuration is complete, run the display bulk-stat command to view information about the bulk statistics collection module. Run the display bulk-stat file-name command to view detailed information about the bulk file.
# View detailed information about the bulk file file1.
[Switch] display bulk-stat file1 bulk file file1: ---------------------------------- storage: ephemeral format: bulkASCII collect interval: 10 min transfer interval: 10 min primary transfer URL: ftp://user@10.1.1.1 secondary transfer URL: tftp://10.1.1.1/folder/bulkstat2 transfer retry times: 5 file remain time: 10 min status: ready last transfer success time: NULL last transfer fail time: NULL total object number: 2 ---------------------------------- index: 1 class: single OID: 1.3.6.1.2.1.2.1.0 start index: NULL instance number: NULL ---------------------------------- index: 2 class: column OID: 1.3.6.1.2.1.2.2.1.4 start index: 0 instance number: 0 ----------------------------------
The generated statistics files are displayed in the specified path on the server. In this example, a statistics file is generated every 10 minutes.
Configuration Files
Switch configuration file
# sysname Switch # bulk-stat enable # bulk-file file1 collect interval 10 transfer interval 10 transfer remain-time 10 transfer primary protocol ftp username user password %^%#'Yi'VM345=n5\LQ1G%\IQ'O6GM"WU:YI#uVCL[$D%^%# host 10.1.1.1 transfer secondary protocol tftp host 10.1.1.1 path folder/bulkstat2 collect enable object 1.3.6.1.2.1.2.1.0 class single object 1.3.6.1.2.1.2.2.1.4 class column # return