使用 MX 系列路由器流收集器接口处理和导出多个流记录
基本的被动监控有时会创建大量流量记录。但是,您可以使用流收集器界面管理多个流记录。您可以从监控服务 II PIC 创建流收集器接口。流收集器接口将从监控服务接口接收的多个流记录合并为一个压缩的 ASCII 数据文件,并将该文件导出到 FTP 服务器。
要将监控服务 II PIC 转换为流收集器接口,请在层次结构级别包含[edit chassis fpc fpc-slot pic pic-slot monitoring-services application]该flow-collector语句。要恢复监控服务 II PIC 的监控功能,请在层次结构级别包含[edit chassis fpc fpc-slot pic pic-slot monitoring-services application]该monitor语句。
提交配置以在 和flow-collector服务类型之间monitor转换 PIC 后,必须使 PIC 脱机,然后再使 PIC 重新联机。重新启动路由器不会启用新的服务类型。您可以将监控服务 II PIC 用于流收集或监控,但不能同时使用两种类型的服务。
由 cp-fpc/pic/port 接口名称指定的流收集器接口需要三个逻辑接口才能正确运行。单元 0 和 1 分别用作导出通道 0 和 1,用于将压缩的 ASCII 数据文件发送到 FTP 服务器。您必须为这两个导出通道包括服务等级 (CoS) 配置,以便为文件传输提供足够的带宽。单元 2 用作流接收通道,从监控服务接口接收流记录。
与传统接口不同,流收集器逻辑接口的 IP 地址在路由引擎和流收集器之间建立点对点连接。address层次结构级别的[edit interfaces cp-fpc/pic/port unit unit-number family inet]语句对应于路由引擎的 IP 地址。同样,destination层次结构级别的[edit interfaces cp-fpc/pic/port unit unit-number family inet address ip-address]语句对应于流收集器接口的 IP 地址。因此,您必须destination为单元 0 和 1(导出通道 0 和 1)配置可到达 FTP 服务器的本地地址的语句。同样,使用本地 IP 地址配置destination单元 2(流接收通道)的语句,以便它可以访问发送流记录的监控服务接口。
要在监控服务 II PIC 转换为流收集器之后激活流收集器服务,请在层次结构级别包含[edit services]该flow-collector语句。您还需要配置几个附加组件:
FTP 服务器的目标 — 确定在收集和处理流记录后,压缩的 ASCII 数据文件的发送位置。要指定目标 FTP 服务器,请在层次结构级别包含
[edit services flow-collector]该destinations语句。您最多可以指定两个 FTP 服务器目标,并为每个配置的服务器添加密码。如果配置了两台 FTP 服务器,则配置中的第一台服务器为主服务器,另一台为备份服务器。文件规格 - 预设数据文件格式、名称格式和传输特征。当计时器到期或收到预设数量的记录时,文件将通过 FTP 发送到目标 FTP 服务器(以先到者为准)。要设置数据文件格式,请在 file-specification file-name] 层次结构级别包含
data-format[edit services flow-collector该语句。默认数据格式为flow-compressed。要设置导出计时器和文件大小阈值,请在层次结构级别包括[edit services flow-collector该语句,并为和选项指定值record-leveltimeout。transferfile-specification file-name]默认值为 600 秒timeout,500,000 条记录record-level。要设置文件名格式,请在
name-formatfile-specification file-name] 层次结构级别包含[edit services flow-collector该语句。表 1 中包含可在配置中使用的通用名称格式宏。表 1:名称格式宏 字段
扩展
{am_pm}
AM或PM{date}
使用 ,
{day}, and {year}宏展开{month}到当前日期。{day}
01到31{day_abbr}
Sun通过Sat{day_full}
Sunday通过Saturday{generation_number}
为创建的每个新文件展开为唯一的序列号。
{hour_12}
01到12{hour_24}
00到23{ifalias}
展开为逻辑接口的说明字符串。
{minute}
00到59{month}
01到12{month_abbr}
Jan通过Dec{month_full}
January通过December{num_zone}
-2359到+2359{second}
00到60{time}
使用 、
{minute}和{second}宏展开{hour_24}到创建文件的时间。{time_zone}
区域设置的时区代号(
gmt, pst,依此类推)。{year}
1970, 2008,依此类推。{year_abbr}
00到99输入接口到流收集器接口映射 — 将输入接口与流收集器接口匹配,并将预设的文件规范应用于输入接口。要为所有输入接口配置默认流收集器和文件规范,请在
[edit services flow-collectorinterface-map]层次结构级别包含file-specificationandcollector语句。要覆盖默认设置并将流收集器和文件规范应用于特定输入接口,请在层次结构级别包括file-specification[edit services flow-collectorinterface-map interface-name]andcollector语句。传输日志设置 — 允许您配置要存档包含流收集器接口传输活动历史记录的日志文件的目标 FTP 服务器、日志文件的名称以及路由器在将日志文件发送到 FTP 服务器之前等待的时间。要进行配置,请在层次结构级别包括
archive-sites[edit services flow-collectortransfer-log-archive]、filename-prefix和maximum-age语句。语maximum-age句的默认值为 120 分钟,范围为 1 到 360 分钟。此外,您最多可以配置五个 FTP 存档站点服务器来接收日志文件。其他设置 — 允许您配置分析器的 IP 地址、分析器的标识符、流收集器接口尝试将传输日志文件发送到 FTP 服务器的最大次数,以及流收集器接口在两次重试尝试之间等待的时间长度等值。要进行配置,请在层次结构级别包括
analyzer-address[edit services flow-collector]、 、analyzer-idretry和retry-delay语句。语句的retry范围是 0 到 10 次重试尝试。该retry-delay语句的默认值为 30 秒,范围为 0 到 60 秒。
要将流收集器接口指定为来自监控服务或监控服务 II PIC 的流记录的目标,请在层次结构级别包含[edit forwarding-options monitoring group-name family inet output flow-export-destination]该collector-pic语句。您可以选择流收集器接口或流服务器作为流记录的目标,但不能同时选择这两种目标类型。
还有一个用于流收集器接口的瞻博网络企业管理信息库 (MIB)。流收集器服务 MIB 允许您使用 SNMP 监控流收集器接口。MIB 提供有关流收集器接口的文件、记录、内存、FTP 和错误状态的统计信息。它还针对不可用的目标、文件传输不成功、流量过载和内存过载提供 SNMP 陷阱。有关更多信息,请访问 SNMP MIB 资源管理器,查看特定于瞻博网络的 MIB。
总之,要实现流收集器服务,请在层次结构级别包含[edit chassis][edit interfaces][edit forwarding-options][edit services]语句。以下几页的摘录显示了流收集器服务配置层次结构。有关完整配置示例,请参阅示例:在 M、MX 或 T Series 路由器上配置流量收集器接口。
[edit]
chassis {
fpc fpc-slot {
pic pic-slot {
monitoring-services {
application flow-collector;
}
}
}
}
interfaces {
cp-fpc/pic/port {
description ”flow_collector_interface”;
unit 0 {
family inet {
address ip-address {
destination ip-address;
}
}
}
unit 1 {
family inet {
address ip-address {
destination ip-address;
}
}
}
unit 2 {
family inet {
address ip-address {
destination ip-address;
}
}
}
}
interface-fpc/pic/port {
description “export_interface”;
unit 0 {
family inet {
address ip-address;
}
}
}
mo-fpc/pic/port {
description “monitoring_services_interface”;
unit 0 {
family inet;
}
}
Ethernet-based-interface-fpc/pic/port {
description “ input_interface”;
encapsulation encapsulation-type;
}
}
forwarding-options {
monitoring group1 {
family inet {
output {
export-format cflowd-version-5;
flow-active-timeout value;
flow-inactive-timeout value;
flow-export-destination collector-pic;
interface mo-fpc/pic/port {
source-address ip-address;
}
}
}
}
}
services {
flow-collector {
analyzer-address ip-address;
analyzer-id name;
retry value;
retry-delay seconds;
destinations {
"ftp://username@ftp-server-address-1//directory/" {
password "encrypted-password";
}
"ftp://username@ftp-server-address-2//directory/" {
password "encrypted-password";
}
}
file-specification {
file-specification-name {
}
data-format flow-compressed;
transfer timeout value record-level size;
}
}
interface-map {
file-specification file-specification-name;
collector cp-fpc/pic/port;
interface-name {
file-specification file-specification-name;
collector cp-fpc/pic/port;
}
}
transfer-log-archive {
filename-prefix filename;
maximum-age timeout-value;
archive-sites {
"ftp://username@ip-address//directory/" {
password "encrypted-password";
}
}
}
}