Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
You can define conditions that will trigger an alarm, as well as an optional action to be triggered by the alarm, such as publishing an alarm notification within IAP, sending an email or SMS notification, or executing a job object.
IAP/MQ Alarm Requests and Responses
Alarm Configuration
The alarm’s current configuration is reported in the following topic (See Alarm in API Reference):
You can manage alarms by publishing one of the actions (create, delete, or update) on the alarm do topic (See Manage Alarms in API Reference):
glp/0/{SID}/rq/alarm/{Handle}/do
We are configuring alarm for datapoint relay-val/value/level on dio device for interface if/relay/2.
apollo@smartserver-17q2d9x:~$ mosquitto_sub -t glp/0/17q2d9x/fb/dev/iox.409e21/dio/if/relay/2
{
"desc": "Relay output",
"type": "iox-profiles-0/relay",
"relay-val": {
"desc": "iox-relay",
"type": "iox-datapoints-0/relay-val",
"property": false,
"cat": "in",
"value": {
"level": false
},
"values": {
"level": "17",
"levels": {
"17": {
"level": false
}
},
"inactive": {
}
}
}
}
^C
apollo@smartserver-17q2d9x:~$
Alarm activation condition need to set while creating alarm. We are activating alarm when the level value becomes true.
apollo@smartserver-17q2d9x:~$ mosquitto_pub -t glp/0/17q2d9x/rq/alarm/alarm_1/do -m '{"action":"create","args":{"enabled":true,"cat":"alarm","activation":"eq(\"glp/0/17q2d9x/fb/dev/iox.409e21/dio/if/relay/2/relay-val/value/level\", true)","ackd":true}}'
apollo@smartserver-17q2d9x:~$
apollo@smartserver-17q2d9x:~$ mosquitto_sub -t glp/0/+/fb/alarm/alarm_1/sts
{"state":"enabled","mru":"2019-04-15 10:46:25.792 UTC"}
apollo@smartserver-17q2d9x:~$ mosquitto_sub -t glp/0/+/fb/alarm/alarm_1/cfg
{"desc":null,"enabled":true,"cat":"alarm","ackd":true,"activation":"eq(\"glp/0/17q2d9x/fb/dev/iox.409e21/dio/if/relay/2/relay-val/value/level\", true)","deactivation":null,"message":null,"urgent":false,"actions":null,"severity":null,"mru":"2019-04-15 11:42:01.515 UTC"}
apollo@smartserver-17q2d9x:~$ mosquitto_sub -t glp/0/+/ev/alarm
<----NO OUTPUT--->
To activate an alarm we have to set the datapoint value of "relay-val" level to true.
apollo@smartserver-17q2d9x:~$ mosquitto_pub -t glp/0/17q2d9x/rq/dev/iox.409e21/dio/if/relay/2 -m '{"relay-val": {
"value": {
"level": true
}
}
}'
apollo@smartserver-17q2d9x:~$
apollo@smartserver-17q2d9x:~$ mosquitto_sub -t glp/0/+/ev/alarm
{"id":264,"cat":"alarm","utc":"2019-04-15 10:48:22.304 UTC","language":"en","local":"2019-04-15 16:18:22.304 IST","message":"eq(\"glp/0/17q2d9x/fb/dev/iox.409e21/dio/if/relay/2/relay-val/value/level\", true)","topic":"glp/0/17q2d9x/rq/alarm/alarm_1","urgent":false,"active":true,"acknowledged":false,"acknowledge":"glp/0/17q2d9x/rq/alarm/alarm_1","source":"alarm"}
To deactivate an alarm we have to unset the datapoint value of "relay-val" level to false.
apollo@smartserver-17q2d9x:~$ mosquitto_pub -t glp/0/17q2d9x/rq/dev/iox.409e21/dio/if/relay/2 -m '{"relay-val": {
"value": {
"level": false
}
}
}'
apollo@smartserver-17q2d9x:~$ mosquitto_sub -t glp/0/+/ev/alarm
{"id":266,"cat":"alarm","utc":"2019-04-15 10:55:32.824 UTC","language":"en","local":"2019-04-15 16:25:32.824 IST","message":"eq(\"glp/0/17q2d9x/fb/dev/iox.409e21/dio/if/relay/2/relay-val/value/level\", true)","topic":"glp/0/17q2d9x/rq/alarm/alarm_1","urgent":false,"active":false,"acknowledged":false,"acknowledge":"glp/0/17q2d9x/rq/alarm/alarm_1","source":"alarm"}
Following is the example of deleting an alarm "alarm_1"
apollo@smartserver-17q2d9x:~$ mosquitto_pub -t glp/0/17q2d9x/rq/alarm/alarm_1/do -m '{"action":"delete"}'
apollo@smartserver-17q2d9x:~$ mosquitto_sub -t glp/0/+/fb/alarm/alarm_1/sts
{"state":"deleted","mru":"2019-04-15 11:10:56.932 UTC"}
IAP/REST Alarm Operations
Get all alarms, unless a filter or pagination is specified. (See Alarms in API Reference.)
GET
/iap/alarms
Example https://localhost:8443/iap/alarms?order=asc&pg=1&sortBy=timestamp&sz=25
Example of success response:
[
{
"id": 1760,
"timestamp": "2019-01-11T15:27:52.994-08:00[America/Los_Angeles]",
"category": "System-SW",
"severity": "Major Fault",
"state": "Active",
"geozone": {
"id": 88,
"name": "World"
},
"device": {
"id": "Ab93fcpn.25",
"name": "Test Device",
"uid": "00D07111EA6B"
},
"type": "Type mismatch",
"details": "Device type mismatch for device Test Device",
"alarmTargetType": "DEVICE"
}
]
Get either the count of active alarms that the current user is permitted to get, or returns the count of active alarms for the current moment. (See Alarms in API Reference.)
GET
/iap/alarms/count
Example https://localhost:8443/iap/alarms/count
Example of success response:
{
"value": 5
}
Get all alarms related to the specified device, including the cleared ones. (See Alarms in API Reference.)
GET
iap/alarms/dev/{deviceId}
Example https://localhost:8443/iap/alarms/device/Ab93fcpn.25
Example of success response:
[
{
"id": 1760,
"timestamp": "2019-01-11T15:27:52.994-08:00[America/Los_Angeles]",
"category": "System-SW",
"severity": "Major Fault",
"state": "Active",
"geozone": {
"id": 88,
"name": "World"
},
"device": {
"id": "Ab93fcpn.25",
"name": "Test Device",
"uid": "00D07111EA6B"
},
"type": "Type mismatch",
"details": "Device type mismatch for device Test Device",
"alarmTargetType": "DEVICE"
}
]
Get all alarms IDs that are accessible to the current customer. (See Alarms in API Reference.)
GET
iap/alarms/ids
Example https://localhost:8443/iap/alarms/ids?order=asc&pg=1&sortBy=timestamp&sz=25
Example of success response:
[
1760,
1765
]
Returns all alarms related to specified devices including the cleared ones. (See Alarms in API Reference.)