IFTTT Integration
The free web-based IFTTT service lets you combine web applications using simple conditional instructions. Each supported service has several triggers that you can use to trigger the actions of other services. This lets you, for example, change brightness and color of a smart bulb, and send messages or date to IoT devices.
The Meridian integration uses the Webhooks service, that lets you trigger actions when a specific web request is received. The basic operation is as follows: Meridian polls for alarms and matches the alarm reduction key against a given filter and the alarm’s associated nodes against a given category filter. For the resulting alarm, set the maximum severity and the total count is computed. If one of these values has changed compared to the last poll, one or more events specified for the computed maximum severity will be sent to IFTTT.
IFTTT configuration
To use the IFTTT integration in Meridian you need an IFTTT account.
With this account you can create applets that combine a trigger with an action.
In our case, we use the Webhooks service as the trigger and define the event name OpenNMS
.
After this step you can combine this trigger with any of the possible supported services and their actions.
In your account service settings for the Webhooks service you find your key in the given service URL.
In the following example this key is X71dfUZsH4Wkl6cjsLjdV
.
On the side of Meridian, you need a configuration that defines which event names to send on an alarm count or severity change.
The configuration file ifttt-config.xml
contains trigger packages.
The operation is as follows: . Meridian retrieves all alarms that have a node associated. . Each trigger package defines whether to take into account only acknowledged alarms. . Compute the maximum severity and alarm count for each trigger package’s category filter and reduction key filter. . Trigger all events defined in the corresponding trigger sets for the computed maximum severity.
The category and reduction key filter accepts Java regular expressions. Using an empty category filter will use all unacknowledged alarms regardless of whether these alarms have nodes assigned.
Each trigger inside a trigger set defines the event name to be triggered and three additional values. Use these values to set additional attributes for the corresponding IFTTT applet action. You can define the following trigger sets:
Name | Execution |
---|---|
ON |
on start of the IFTTT alarm polling daemon to switch on a device |
OFF |
on stop of the IFTTT alarm polling daemon to switch off a device |
NORMAL |
if severity is NORMAL |
WARNING |
if severity is WARNING |
MINOR |
if severity is MINOR |
MAJOR |
if severity is MAJOR |
CRITICAL |
if severity is CRITICAL |
You can use the ON and OFF events when initializing devices or powering them up/down.
OpenNMS configuration
IFTTT alarm polling will be enabled by setting the attribute enabled
to true
in the ifttt-config.xml
file.
It is also possible to configure the polling interval.
The following trigger package defines the trigger sets which themselves define a sequence of events to be triggered at IFTTT.
Each trigger defines the eventName and an additional delay.
This lets you defer the execution of the next trigger in a trigger set.
Example
The following example shows the configuration file for a WiFi light bulb controlled via IFTTT.
The defined applets use value1
for setting the color and value2
for setting the brightness.
The third value demonstrates the use of placeholders.
For the severity-based trigger sets, you can use the following placeholders in the three value fields:
%os%
/%oldSeverity
for old severity, %ns%
/%newSeverity%
for new severity, %oc%
/%oldCount
for old alarm count and %nc%
/``%newCount% for new alarm count.
This is useful for sending messages or operating LED displays via IFTTT.
<ifttt-config enabled="true" key="X71dfUZsH4Wkl6cjsLjdV" pollInterval="30">
<trigger-package categoryFilter="Routers|Switches" reductionKeyFilter=".*" onlyUnacknowledged="true">
<trigger-set name="ON">
<trigger eventName="on" delay="0">
<value1></value1>
<value2></value2>
<value3></value3>
</trigger>
</trigger-set>
<trigger-set name="OFF">
<trigger eventName="off" delay="0">
<value1></value1>
<value2></value2>
<value3></value3>
</trigger>
</trigger-set>
<trigger-set name="NORMAL">
<trigger eventName="OpenNMS" delay="0">
<value1>#336600</value1>
<value2>0.40</value2>
<value3>%os%,%ns%,%oc%,%nc%</value3>
</trigger>
</trigger-set>
<trigger-set name="WARNING">
<trigger eventName="OpenNMS" delay="0">
<value1>#FFCC00</value1>
<value2>0.50</value2>
<value3>%os%,%ns%,%oc%,%nc%</value3>
</trigger>
</trigger-set>
<trigger-set name="MINOR">
<trigger eventName="OpenNMS" delay="0">
<value1>#FF9900</value1>
<value2>0.60</value2>
<value3>%os%,%ns%,%oc%,%nc%</value3>
</trigger>
</trigger-set>
<trigger-set name="MAJOR">
<trigger eventName="OpenNMS" delay="0">
<value1>#CC3300</value1>
<value2>0.70</value2>
<value3>%os%,%ns%,%oc%,%nc%</value3>
</trigger>
</trigger-set>
<trigger-set name="CRITICAL">
<trigger eventName="OpenNMS" delay="0">
<value1>#FF0000</value1>
<value2>0.80</value2>
<value3>%os%,%ns%,%oc%,%nc%</value3>
</trigger>
</trigger-set>
<trigger-package>
</ifttt-config>