2013-04-22 61 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