配置批量统计功能示例
组网需求
如图1-12所示,现有网络中网管NMS1对网络中的设备进行监管。在规划时已配置设备使用SNMPv3版本与网管进行通信,并配置认证加密功能保证安全性。由于网管通过SNMP获取系统信息的请求是以轮询的方式被逐条发送到设备端的,设备端也是逐条进行回应的,产生的结果就是网管端与设备之间会有大量的信息交互,给网络带宽以及设备端的资源都带来很大的消耗。
用户希望对被监管设备的一些指定的统计信息能够定期主动向网管发送,主用ftp方式发送,备用tftp方式发送。
配置思路
通过配置批量统计的基本功能可以实现被监管设备定期采集若干统计对象,然后生成文件,并且以FTP/TFTP的方式上传到网管,通过配置批量统计文件上传属性定义上传周期、上传时的文件保留时间以及上传最大重传次数。
采用如下的思路配置批量统计功能:
在设备上使能批量性能采集功能。
配置统计文件,包括采集周期,上传周期,文件保留时间,上传主URL等。
配置统计文件待采集的统计对象。
启动统计文件。
操作步骤
- 在设备上使能批量性能采集功能。
<Quidway> system-view [Quidway] sysname Switch [Switch] bulk-stat enable
- 配置统计文件,包括采集周期、上传周期、文件保留时间、上传主URL等。
# 配置名为“file1”的统计文件,采集周期、上传周期、文件保留时间均为10分钟,主URL为FTP方式,备用tftp方式发送。其中,FTP方式中需要配置FTP用户名、密码、FTP服务器的IP地址。
[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
- 配置统计文件待采集的统计对象。
# 配置single类型的统计对象。
[Switch-bulk-file-file1] object 1.3.6.1.2.1.2.1.0 class single
# 配置column类型的统计对象。
[Switch-bulk-file-file1] object 1.3.6.1.2.1.2.2.1.4 class column
- 启动统计文件。
[Switch-bulk-file-file1] collect enable [Switch-bulk-file-file1] quit
- 验证配置结果
验证时,服务器端要求已经启动FTP/TFTP服务。
配置完成后,在设备上使用display bulk-stat命令可以查看当前批量性能采集模块的信息,使用display bulk-stat file-name可以查看到文件的详细信息。
# 查看文件“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 ----------------------------------
在服务器端的指定路径下,可以查看到生成的统计文件。在本示例中每10分钟生成一个统计文件。
配置文件
Switch的配置文件
# 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