I am currently evaluating siddhi for use in a snmp environment. The POC is build around network interface utilization.
A stream is defined as:
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)
The query for calculating interface utilization as:
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;
The problem is that the query seems to run only once. 4 events were added to the interfaceStatsEvents stream. Was expecting 3 events to be generated for interfaceUtilization, instead only a single event was generated.
Does anyone have an idea on the reason for that or how to fix the query?