Clear alarm
This Node loads the latest Alarm with configured Alarm Type for Message Originator and Clear the Alarm if it exist.
Node Configuration:
Alarm Details Builder script
Alarm Type - any string that represents Alarm Type
The rule node has the ability to get alarm type using pattern with fields from message metadata:
Alarm Details Builder script used for updating Alarm Details JsonNode. It is useful for storing additional parameters inside Alarm. For example you can save attribute name/value pair from Original Message payload or Metadata.
Alarm Details Builder script should return details object.
Message payload can be accessed via
msg
property. For examplemsg.temperature
Message metadata can be accessed via
metadata
property. For examplemetadata.customerName
Message type can be accessed via
msgType
property. For examplemsgType
Current Alarm Details can be accessed via
metadata.prevAlarmDetails
.
Note that metadata.prevAlarmDetails
is a raw String field and it needs to be converted into object using this construction:
Alarm Details Builder script function can be verified using Test JavaScript function.
Example of Details Builder Function
This function takes count
property from previous Alarm and increment it. Also put temperature
attribute from inbound Message payload into Alarm details.
This Node updates Current Alarm:
change alarm status to CLEARED_ACK if it was already acknowledged, otherwise to CLEARED_UNACK
set clear time to current system time
update Alarm details with new object returned from Alarm Details Builder script
In case when Alarm does not exist or it is already Cleared Alarm, original Message will be passed to the next nodes via False chain.
Otherwise new Message will be passed via Cleared chain.
Outbound message will have the following structure:
Message Type - ALARM
Originator - the same originator from inbound Message
Payload - JSON representation of Alarm that was cleared
Metadata - all fields from original Message Metadata. Also additional property inside Metadata will be added -> isClearedAlarm with true value.
Here is an example of Outbound Message payload
Last updated