-
Notifications
You must be signed in to change notification settings - Fork 72
Support custom fragments in alarm creation #1682
Description
Is your feature request related to a problem? Please describe.
When creating an alarm via a json payload, custom fragments are ignored and not included when creating the Cumulocity IoT Alarm.
Describe the solution you'd like
Alarm creation via a json payload should include any custom fragments provided when creating the Cumulocity IoT Alarm.
Example
The following command publishes a CRITICAL alarm of type myCustomAlarmType to thin-edge.io. It also includes a custom fragment called someOtherCustomFragment which includes extra information about the alarm.
tedge mqtt pub tedge/alarms/critical/myCustomAlarmType/child_device_example '{ "text": "Some test alarm", "someOtherCustomFragment": {"nested":{"value": "extra info"}} }'
The above command should produce an alarm in Cumulocity IoT which the custom fragment someOtherCustomFragment is also present (the source fragment was left out for demonstrative purposes only).
{
"severity": "critical",
"someOtherCustomFragment": {
"nested": {
"value": "extra info"
}
},
"text": "Some test alarm",
"time": "2023-01-17T09:42:28.804Z",
"type": "myCustomAlarmType"
}Event creation via json already supports custom fragments, so adding custom fragment support to alarm creation would provide a more consistent interface for users.
Describe alternatives you've considered
No other solution was considered.
Additional context
Note: If the alarm existing for the same type is already ACTIVE or ACKNOWLEDGED then the custom fragment information will be ignored by Cumulocity IoT, and only the count fragment will be incremented by 1. The custom fragment information is only accepted by Cumulocity IoT if the alarm is "new".