It is possible to obtain metric value changes in realtime, when metric value has exceeded or dropped below specified threshold. This is done using alarms which can be obtained via STOMP over Websocket by /alarm event subscription
Alarm creation
A new alarm can be created with REST API query /api/alarm/create
https://hostname:8090/api/alarm/create { "type":"0", "name":"testalarm", "value":"500000", "metric":"4", "node":"15", "time":"5000" }
Where
- type – alarm type:
- 0 – value has dropped below the threshold
- 1 – value has exceeded the threshold
- name – alarm name
- value – threshold value
- metric – metric identifier (video bitrate for example)
- node – node identifier
- time – time in milliseconds during which the metric value must be above or below the threshold.
In the example above, the alarm was created that triggers if the video bitrate of the stream drops below 500 kbps for more than 5 seconds.
If node Id is not set, the alarm applies to all the nodes on backend server.
Alarm changing
Alarm parameters can be changed with REST API query /api/alarm/update
https://hostname:8090/api/alarm/update { "id": "17", "type":"0", "name":"testalarm", "value":"500000", "metric":"4", "node":"15", "time":"5000" }
Where:
- id – alarm identifier
- type – alarm type:
- 0 – value has dropped below the threshold
- 1 – value has exceeded the threshold
- name – alarm name
- value – threshold value
- metric – metric identifier (video bitrate for example)
- node – node identifier
- time – time in milliseconds during which the metric value must be above or below the threshold.
Alarm deletion
Alarm can be deleted with REST API query /api/alarm/delete
https://hostname:8090/api/alarm/delete { "id": "17" }
Where:
- id – alarm identifier
STOMP messages about the alarm triggering stop when alarm is deleted.
Obtaining alarm information
Alarm information can be obtained with REST API query /api/alarm/list
https://hostname:8090/api/alarm/list { "id": "17" }
Where:
- id – alarm identifier
If alarm Id is set, the response will contain this alarm information only. If alarm Ids is not set, the response will contain all the alarms list on backend server.
The response contains the same fields for every alarm as /api/alarm/update query.