|
Alert Examples |
Top Previous Next |
|
This article provides some non-trivial alert configurations that can be used as a reference for creating your own custom alerts. Trigger Expression Examples Here are some real-life examples of alert trigger expressions:
Impact Warning Alert Let's assume that our hardware device is a forklift controller that may generate Impact event when forklift collides with some obstacle. This event contains Level field that represents impact level, higher levels indicate more severe impacts. The Impact Warning alert has a single Event Trigger which fires due to the Impact event in the Data Terminal context if the Integer level field in event data is greater than 50 (i.e. alert is raised only for severe impacts) . Alert Info
Triggers Activated by Events
Alert Notifications
Several Harware Devices in Trouble This complex example show how integration of two powerful features, alerts and queries, may be helpful to detect error conditions that involve several Device. Assuming that ten temperature sensors are connected to AggreGate Server and owned by user john. The Data Terminal context of every sensor has a Temperature variable (variable name: temperature) whose value has an Integer field, celsius, containing the temperature in Celsius. Suppose the temperature of every individual sensor is not critical, but if three or more sensors report temperature greater than 100 degrees this may lead to problems in the future, and an alert should be raised to let the operators know there's a problem. We'll use a query that helps to find all thermometers reporting temperature over than 100 degrees: SELECT * FROM users.john.devices.*:temperature WHERE temperature$celsius > 100 This query returns a table (Data Table) containing one record per every sensor showing high temperature. We can execute the above query by calling the executeQuery function from the Root context and passing the query text to it as an input parameter. So the idea is to set up an alert with a trigger that periodically executes this query and checks the number of records in its output. If the number is greater than three, the trigger fires. Variable triggers may not be used to check function output directly, but here we must check a function's output -- executeQuery is a function. As covered above, alerts can be triggered in two ways -- when an event (so-called "event triggers") happens, or according to the value of some variable ("variable trigger"). For our example, we'll use a "variable" trigger, but we'll hack it a little bit. A variable trigger always has a context, a variable and an expression. Now, expressions can actually invoke functions. So we're going to create an alert which has a meaningless context, a meaningless variable (which is still valid for that context), and a very meaningful expression. This expression won't even refer to the context and variable of the alert. We care only about the expression in this case, because it causes the query to be executed for us. The other parts (context and variable) are just placeholders. As placeholders, we'll use the "" (root) context and the version read-only variable, containing the server version. Out alert will be raised when the expression evaluates to true. To access the number of records contained in the output of the executeQuery function we will use the records property (see References for details about the reference resolving process). So, the final reference that will return the number of thermometers registering a high temperature looks like this: {:executeQuery("SELECT * FROM users.john.devices.*:temperature WHERE temperature$celsius > 100")#records} How it works:
Alert Info
Variable Triggers
Alert Notifications
|