2013-04-22 24 views
0

我目前正在评估siddhi在一个SNMP环境中使用。 POC建立在网络接口利用率的基础上。西提查询网络利用率

甲流被定义为:

define stream interfaceStatsEvents (nodeName string, sdate double, ifSpeed long, ifIndex string, ifAdminStatus string, ifOperStatus string, 
ifInDiscards long, ifInErrors long, ifOutDiscards long, ifOutErrors long, ifInOctets long, ifOutOctets long) 

用于计算接口利用率作为查询:

from every (e1 = interfaceStatsEvents -> e2 = interfaceStatsEvents[nodeName == e1.nodeName and ifIndex == e1.ifIndex]) 
select e1.nodeName, e1.ifIndex, ((e2.ifInOctets - e1.ifInOctets) * 8 * 100)/(((e2.sdate - e1.sdate)/1000) * e1.ifSpeed) as utilization 
insert into interfaceUtilization; 

的问题是,该查询似乎只运行一次。 事件加入到interfaceStatsEvents流。预计将为interfaceUtilization生成3个事件,而不是仅生成单个事件。

是否有人在为或如何解决查询原因的想法?

回答

0

这里使用的是每一个为整个模式的问题,因此这将输出为每个E1,E2组合

from every (e1 = interfaceStatsEvents -> e2 = interfaceStatsEvents[nodeName == e1.nodeName and ifIndex == e1.ifIndex]) 

为你的预期,即对每个E1之后E2你得到一个输出改变查询为

from every e1 = interfaceStatsEvents -> e2 = interfaceStatsEvents[nodeName == e1.nodeName and ifIndex == e1.ifIndex] 

这里的每一个只适用于e1而不适用于e1-e2组合。

+0

谢谢。这就说得通了。 – roelof 2013-04-30 08:06:45