[英]wso2 cep Siddhiql
I have multiple sensors sending measurement events to a stream. 我有多个传感器将测量事件发送到流。 An event consists of {parameter, value, timestamp} .
事件由{parameter,value,timestamp}组成 。 I want to observe these values for a time window of few days and check the trends and make diagnostics about the equipment being monitored by these different sensors.
我想在几天的时间范围内观察这些值,并检查趋势并诊断由这些不同传感器监视的设备。
from inputStream[parameter='A'] select * insert into Astream;
and so on for each parameter being received. 对于每个接收到的参数,依此类推。
from Astream#timeseries:lengthTimeRegress(60000, value, timestamp) select beta1 * 100 as AChange insert into AChangeStream;
This I do for each metric stream. 我为每个指标流执行此操作。 3. Once I have trend for each stream, I collect the changed values for each stream and check if they meet the condition.
3.确定每个流的趋势后,我将收集每个流的更改值并检查它们是否满足条件。
from every e1=AChangeStream[e1.AChangeStream > 0.5], e2=BChangeStream[e2.BChangeStream 0.15] select 'condition 1 alarm' as message insert into alertStream;
Will the above siddhi ql detect the changes in 6 parameters in the time window? 上面的siddhi ql是否可以检测到时间窗口中6个参数的变化?
The gist of the query you have provided is correct except for few minor things you have missed. 您提供的查询的要旨是正确的,除了您错过的一些小事情。 When you say 6 parameters, I believe that you have something similar to Parameters A, B, C, D, E and F. Eventually you seem to want to find a sequence of events that match the given condition [1].
当您说6个参数时,我相信您具有与参数A,B,C,D,E和F相似的东西。最终,您似乎希望找到一个符合给定条件的事件序列[1]。
Considering only 2 Parameters A and B, you could write the queries in Siddhi language as follows, to achieve your requirement. 仅考虑2个参数A和B,您可以按以下方式用Siddhi语言编写查询,以实现您的要求。
@Import('input:1.0.0') define stream inputStream (parameter string, value double, timestamp long); from inputStream[parameter=='A'] select * insert into Astream; from inputStream[parameter=='B'] select * insert into Bstream; from Astream#timeseries:lengthTimeRegress(60000, 10000, value, timestamp) select beta1*100 as AChange insert into AChangeStream; from Bstream#timeseries:lengthTimeRegress(60000, 10000, value, timestamp) select beta1*100 as BChange insert into BChangeStream; from every e1=AChangeStream[e1.AChange > 0.5], e2=BChangeStream[e2.BChange > 0.15] select 'condition 1 alarm' as message insert into alertStream;
Please note the following. 请注意以下事项。
[1] https://docs.wso2.com/display/CEP420/SiddhiQL+Guide+3.1#SiddhiQLGuide3.1-Sequence [1] https://docs.wso2.com/display/CEP420/SiddhiQL+Guide+3.1#SiddhiQLGuide3.1-Sequence
[2] https://docs.wso2.com/display/SIDDHIEXTENSIONS/Regression [2] https://docs.wso2.com/display/SIDDHIEXTENSIONS/Regression
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.