Messages are published to the SNS topic when an alarm status is updated, and when an alarm threshold is set or modified. The messages types are PointAlarmStatusEvent
and SetPointAlarmThresholdEvent
, respectively. Examples of the content of these events are given below.
type Record struct { AggregateID string `json:"aggregateId"` SequenceID string `json:"sequenceId"` Timestamp int64 `json:"timestamp"` Type string `json:"type"` Data []byte `json:"data"` UserID string `json:"userId"` }
The events themselves are marshaled JSON objects that are provided in the Data
field of the type given above.
The messages are published with 2 string message attributes. SKF.Hierarchy.EventType
will be the event type, e.g. PointAlarmStatusEvent
. SKF.Hierarchy.Aggregate
will contain the aggregate ID, which in the events sent by the service will be the node ID the event occurred on. In the case of SetPointAlarmThresholdEvent
, it will be the node the threshold was set on.
The format of the messages follows the structure returned by the GET /v1/alarm-status/{nodeId}
.
The meaning of the enumerated field types (e.g. alarmStatus
) are documented here. E.g., the 2
used as alarmStatus
in the example given below corresponds to the alarm status GOOD
.
The example given below is an alarm status contains two alarms, an inspection alarm and an externally set alarm. The top level alarmStatus
is the worst of these, which in this case is 3
, which in turn corresponds to the alarm status being ALERT
.
{ "aggregateId": "123e4567-e89b-12d3-a456-426614174000", "userId": "123e4567-e89b-12d3-a456-426614174001", "sequenceId": "01FJ7EH9HHHGKSXGFPG8R4YE88", "updatedAt": 1633939101250, "alarmStatus": 2, "alarmsChanged": true, "inspectionAlarm": { "status": 2, "triggeringMeasurement": "123e4567-e89b-12d3-a456-426614174000" }, "externalAlarm": { "status": 3, "setBy": "123e4567-e89b-12d3-a456-426614174000" } }
{ "aggregateId": "123e4567-e89b-12d3-a456-426614174000", "userId": "123e4567-e89b-12d3-a456-426614174001", "sequenceId": "01FJ7EH9HHHGKSXGFPG8R4YE88", "updatedAt": 1633939101250, "alarmStatus": 2, "alarmsChanged": true, "overallAlarm": { "status": 2, "triggeringMeasurement": "123e4567-e89b-12d3-a456-426614174000" }, }
{ "aggregateId": "123e4567-e89b-12d3-a456-426614174000", "userId": "123e4567-e89b-12d3-a456-426614174001", "sequenceId": "01FJ7EH9HHHGKSXGFPG8R4YE88", "updatedAt": 1633939101250, "alarmStatus": 2, "alarmsChanged": true, "inspectionAlarm": { "status": 2, "triggeringMeasurement": "123e4567-e89b-12d3-a456-426614174000" }, }
This alarm status is set using the PUT /v1/alarm-status/{nodeId}/status/external
endpoint. setBy
is set by the caller and is optional. If not set it will not be included in the message body.
{ "aggregateId": "123e4567-e89b-12d3-a456-426614174000", "userId": "123e4567-e89b-12d3-a456-426614174001", "sequenceId": "01FJ7EH9HHHGKSXGFPG8R4YE88", "updatedAt": 1633939101250, "alarmStatus": 2, "alarmsChanged": true, "externalAlarm": { "status": 2, "setBy": "123e4567-e89b-12d3-a456-426614174000" } }
{ "aggregateId": "123e4567-e89b-12d3-a456-426614174000", "userId": "123e4567-e89b-12d3-a456-426614174001", "sequenceId": "01FJ7EH9HHHGKSXGFPG8R4YE88", "updatedAt": 1633939101250, "alarmStatus": 4, "alarmsChanged": true, "bandAlarms": [ { "status": 4, "triggeringMeasurement": "123e4567-e89b-12d3-a456-426614174000", "label": "Name", "minFrequency": { "valueType": 1, "value": 300, }, "maxFrequency": { "valueType": 1, "value": 350, }, "calculatedOverall": { "unit": "gE", "value": 0.1606352786810255 } } ] }
{ "aggregateId": "123e4567-e89b-12d3-a456-426614174000", "userId": "123e4567-e89b-12d3-a456-426614174001", "sequenceId": "01FJ7EH9HHHGKSXGFPG8R4YE88", "updatedAt": 1633939101250, "alarmStatus": 2, "alarmsChanged": true, "halAlarms": [ { "status": 2, "triggeringMeasurement": "123e4567-e89b-12d3-a456-426614174000", "label": "Name", "faultFrequency": 55.8, "halIndex": 1.9, "numberOfHarmonicsUsed": 55.8, "rpmFactor": 4.5, "errorDescription": "Fault frequency < 0" } ] }
TBD