Alarm Service APIs

Content

  • Introduction

  • Alarm Service APIs

Introduction

Alarm service includes a lightweight rule engine, which provides IoT analytics and streaming capability. The rules are based on Source, SQL and Sink.

It is an edge lightweight IoT data analytics / streaming software implemented by Golang, and it can be run at all kinds of resource constrained edge devices. Kuiper rules are based on Source, SQL and Sink.

  • Source: The data source of streaming data, such as data from MQTT broker. In EdgeX scenario, the data source is EdgeX message bus, which could be MQTT broker.

  • SQL: SQL is where you specify the business logic of streaming data processing. Kuiper provides SQL-like statements to allow you to extract, filter & transform data.

  • Sink: Sink is used for sending analysis result to a specified target. For example, send analysis result to another MQTT broker, or an HTTP rest address.

It provides a set of REST API for streams and rules management in addition to CLI.

By default, the REST API are running in port 9081. You can change the port in /etc/kuiper.yaml for the restPort property. We have used support-rulesengine API version 1.0.0 that running in port 48075.

Alarm Service APIs

Rules management

  • create a rule

  • show rules

  • describe a rule

  • update a rule

  • drop a rule

  • start a rule

  • stop a rule

  • restart a rule

  • get the status of a rule

create a rule

(1) Example for MQTT output:

User application subscribes the broker and topic, then will get the alarm data with JSON format as below.

[{"RandomValue_Int8": -6}]

(2) Example for Rest API output:

User application implements the your-restapi-server/api/action method, then the RestAPI server will get the alarm data with JSON format as below.

{RandomValue_Int8: -97}

(3) CPU temperature example for MQTT output:

  • An example of CPU temperature

  • Create a sink that both name and type is EdgeX

  • The sink result will be published to the topic result and you can get the data context from the MQTT broker as below: [{"device":"cpu","temperature":62}]

(4) Battery temperature example for MQTT output:

  • An example of battery temperature

  • Create a sink that name is demo and type is zmq

  • The sink result will be published to the topic result and you can get the data context from the MQTT broker as below: [{"device":"Battery-POC6-01“, "temperature":31}]

(5) Battery remaining capacity example for MQTT output:

  • An example of battery remaining capacity

  • Create a sink that name is demo and type is zmq

  • The sink result will be published to the topic result and you can get the data context from the MQTT broker as below: [{"device":"Battery-POC6-01“, “capacity":100}

show rules

Example:

describe a rule

Example:

update a rule

Example:

drop a rule

Example:

start a rule

Example:

stop a rule

Example:

restart a rule

Example:

get the status of a rule

Example:

Reference:

1.https://github.com/lf-edge/ekuiper/blob/master/docs/en_US/edgex/edgex_rule_engine_tutorial.md 2.https://fuji-docs.edgexfoundry.org/support-rulesengine.html 3.https://github.com/lf-edge/ekuiper/blob/master/docs/en_US/restapi/overview.md 4. https://github.com/lf-edge/ekuiper/blob/master/docs/en_US/sqls/streams.md

Last updated