Alarm management¶
It is possible to obtain metric value changes in realtime, when metric value has exceeded or dropped below specified threshold. That can be done using alarms, which can be obtained via STOMP over Websocket by /alarms
event subscription.
Alarms can be managed using Websocket API or REST API.
Alarm creation¶
A new alarm can be created with /api/alarm/create
request
API | Request | Response | Response status |
---|---|---|---|
WS API | 200 OK 400 Object not found 500 Persist exception | ||
REST API | 200 OK 400 Object not found 500 Persist exception |
Where
type
– alarm type:0
– value has dropped below the threshold1
– value has exceeded the threshold2
- value is equal to threshold4
- monotonically increasing value has decreased5
- monotonically decreasing value has increased
name
– alarm namevalue
– threshold valuemetric
– metric identifier (for example, video bitrate)node
– node identifiertime
– time in milliseconds during which the metric value must be above or below the threshold
In the example above, an alarm, which is triggered if the video bitrate of the stream drops below 100 kbps for more than 1 second, was created.
If node Id is not set, the alarm applies to all the nodes on backend server.
A number of alarms may be set for the same metric, for example, to set low and high bitrate thresholds.
Alarm changing¶
An alarm parameters can be changed with /api/alarm/update
request:
API | Request | Response | Response status |
---|---|---|---|
WS API | 200 OK 400 Object not found 500 Persist exception | ||
REST API | 200 OK 400 Object not found 500 Persist exception |
Where
id
– alarm identifiertype
– alarm type:0
– value has dropped below the threshold1
– value has exceeded the threshold2
- value is equal to threshold4
- monotonically increasing value has decreased5
- monotonically decreasing value has increased
name
– alarm namevalue
– threshold valuemetric
– metric identifier (for example, video bitrate)node
– node identifiertime
– time in milliseconds during which the metric value must be above or below the threshold
Alarm deletion¶
Alarm can be deleted with /api/alarm/delete
request:
API | Request | Response | Response status |
---|---|---|---|
WS API | 200 OK 400 Object not found 500 Persist exception | ||
REST API | 200 OK 400 Object not found 500 Persist exception |
Where
id
– alarm identifier
STOMP messages about the alarm triggering stop when it is deleted.
Obtaining alarm information¶
An alarm information can be obtained with /api/alarm/list
request
Where
id
– alarm identifiertype
– alarm type:0
– value has dropped below the threshold1
– value has exceeded the threshold2
- value is equal to threshold4
- monotonically increasing value has decreased5
- monotonically decreasing value has increased
name
– alarm namevalue
– threshold valuemetric
– metric identifier (for example, video bitrate)node
– node identifiertime
– time in milliseconds during which the metric value must be above or below the threshold
If alarm Id is set, the response will contain only that alarm information. If alarm Id is not set, the response will contain list with all the alarms on backend server.
For every alarm, the response contains the same fields as /api/alarm/update
request.
Alert message receiving¶
Alert messages are received if client is subscribed to /alarms
queue. Alert message looks as follows:
MESSAGE
destination:/alarms
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:4-187
content-length:242
{
"timestamp":1561101716609,
"status":"RAISED",
"alarmType":"LESS",
"alarmValue":700000,
"alarmName":"alarm1",
"mediaId":"617691c0-93f2-11e9-8808-938c74814152",
"metricEnumName":"VIDEO_RATE",
"metricValue":400232,
"nodeHostName":"test.flashphoner.com"
}
Where:
timestamp
- time of alarm raised or clearedstatus
- alarm state:RAISED
- alarm is raisedCLEARED
- alarm is cleared
alarmType
- alarm type:LESS
– value has dropped below the thresholdMORE
– value has exceeded the thresholdEQUA
L - value is equal to thresholdMONOTONIC_UP
- monotonically increasing value has decreasedMONOTONIC_DOWN
- monotonically decreasing value has increased
alarmValue
- alarm threshold valuealarmName
- alarm namemediaId
- media session identifier for the stream which event is occuredmetricEnumName
- metric namemetricValue
- metric value by which alarm was raised or clearednodeHostName
- server hostname on which the stream is published or played