Returns a list of all alerts generated for an account as per the specified criteria. This API is paginated and returns 20 alerts by default. An alert is uniquely identified by a 'sensor_alert_key'. This key should be used in all the other API referencing a particular alert.
Param name | Description |
---|---|
page optional |
Page number of results to be fetched, Default 1 Value: Must be Integer. |
per optional |
Number of alerts to be returned in one page, Default 20 Value: Must be Integer. |
order_by optional |
Field on which alerts should be sorted Value: Must be a String |
order optional |
Order, “asc” or “desc”, in which results should be sorted Value: Must be a String |
search optional |
Keywords based on which alerts should be searched. Value: Must be a String |
scope optional |
Matching condition if multiple keywords are specified for search. Valid values are “all” or “any”. Default is “all” Value: Must be a String |
sensor_key optional |
Sensor for which the alerts should be returned for Value: Must be a String |
instruction_key optional |
Instruction for which the alerts should be returned for Value: Must be a String |
alert_type optional |
Alert types for which alerts should be returned back Value: Must be an array of [0, 1, 2, 3] |
timestamp_format optional |
Format, “str” or “int”, in which timestamps should be returned, Default “int” Value: Must be a String |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
Request - listing all alerts without any criteria curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" https://api.datonis.io/api/v2/sensor_alerts Response (returns first 20 records) { "total_count": 49, "page": 1, "sensor_alerts": [ { "alert_type": 0, "data": { "foo": "bar", "sensor": { "coordinates": null, "description": "A simple sensor", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "type": "SIMPLE", "meta_data": { "type": "object", "additionalProperties": false, "properties": { "cpu": { "type": "number" }, "mem": { "type": "number" } } }, "name": "S-1", "state": "registered", "tags_array": [ ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "", "last_event": 1426504617, "last_beat": 1426504613 }, "alert_type_string": "Info" }, "message": "Example INFO alert from C Agent", "sensor_alert_key": "7eebd3c6e5", "timestamp": 734827, "alert_type_string": "Info", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "sensor_name": "S-1" }, { "alert_type": 1, "data": { "foo": "bar", "sensor": { "coordinates": null, "description": "A simple sensor", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "type": "SIMPLE", "meta_data": { ...
Request - listing alerts by specifying number of alerts to be returned at a time (page size) and specific set to be returned (page) curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" -d '{"per":"2","page":"2"}' https://api.datonis.io/api/v2/sensor_alerts Response (returns page 2 with 2 alerts per page) { "total_count": 49, "page": "2", "sensor_alerts": [ { "alert_type": 2, "data": { "foo": "bar", "sensor": { "coordinates": null, "description": "A simple sensor", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "type": "SIMPLE", "meta_data": { "type": "object", "additionalProperties": false, "properties": { "cpu": { "type": "number" }, "mem": { "type": "number" } } }, "name": "S-1", "state": "registered", "tags_array": [ ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "", "last_event": 1426504617, "last_beat": 1426504613 }, "alert_type_string": "Error" }, "message": "Example ERROR alert from C Agent", "sensor_alert_key": "a5t5d89d17", "timestamp": 734827, "alert_type_string": "Error", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "sensor_name": "S-1" }, { "alert_type": 3, "data": { "foo": "bar", "sensor": { "coordinates": null, "description": "A simple sensor", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "type": "SIMPLE", "meta_data": { ...
Request - listing alerts ordered by a field curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" -d '{"order_by":"alert_type","order":"desc"}' https://api.datonis.io/api/v2/sensor_alerts Response (returns alerts in the reverse order of alert type) { "total_count": 49, "page": 1, "sensor_alerts": [ { "alert_type": 3, "data": { "foo": "bar", "sensor": { "coordinates": [ "18.5203", "73.8567" ], "description": "", "sensor_key": "t42b258f9daef7ee64146651ef1dffc1b441df4t", "type": "Compressor", "meta_data": { "properties": { "pressure": { "type": "number" }, "temperature": { "type": "number" } }, "additionalProperties": false }, "name": "CMP-222", "state": "registered", "tags_array": [ "Pune", "Reciprocating" ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "Pune,Reciprocating", "last_event": null, "last_beat": null }, "alert_type_string": "Critical" }, "message": "This is an example CRITICAL alert using python SDK", "sensor_alert_key": "1f7621f6ea", "timestamp": 1428650668, "alert_type_string": "Critical", "sensor_key": "t42b258f9daef7ee64146651ef1dffc1b441df4t", "sensor_name": "CMP-222" }, { "alert_type": 3, "data": { "foo": "bar", "sensor": { "coordinates": [ "18.5203", "73.8567" ], ...
Request - listing alerts based on some search criteria with all keywords matching curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" -d '{"search":"INFO CMP-222"}' https://api.datonis.io/api/v2/sensor_alerts Response (returns alerts containing both keywords 'INFO' as well as 'CMP-222') { "total_count": 1, "page": 1, "sensor_alerts": [ { "alert_type": 0, "data": { "foo": "bar", "sensor": { "coordinates": [ "18.5203", "73.8567" ], "description": "", "sensor_key": "t42b258f9daef7ee64146651ef1dffc1b441df4t", "type": "Compressor", "meta_data": { "properties": { "pressure": { "type": "number" }, "temperature": { "type": "number" } }, "additionalProperties": false }, "name": "CMP-222", "state": "registered", "tags_array": [ "Pune", "Reciprocating" ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "Pune,Reciprocating", "last_event": null, "last_beat": null }, "alert_type_string": "Info" }, "message": "This is an example INFO alert using python SDK", "sensor_alert_key": "a94t654cf9", "timestamp": 1428650668, "alert_type_string": "Info", "sensor_key": "t42b258f9daef7ee64146651ef1dffc1b441df4t", "sensor_name": "CMP-222" } ] }
Request - listing alerts based on some search criteria with any of the keywords matching curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" -d '{"search":"INFO CMP-222","scope":"any"}' https://api.datonis.io/api/v2/sensor_alerts Response (returns alerts containing either of the keywords 'INFO' or 'CMP-222') { "total_count": 28, "page": 1, "sensor_alerts": [ { "alert_type": 0, "data": { "batch_key": "cc122c27tt", "sensor": { "bi_directional": true, "coordinates": [ "18.5203", "73.8567" ], "description": "", "sensor_key": "27ce8667143fa217b3eb9ecbedcbacdc28addt97", "type": "Energy Meter", "meta_data": { "properties": { "voltage": { "type": "number" }, "power": { "type": "number" } }, "additionalProperties": false }, "name": "EM-101", "state": "registered", "tags_array": [ "1-Phase", "15-Amps", "Pune" ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "1-Phase,15-Amps,Pune", "last_event": null, "last_beat": 1428644239 }, "instruction": { "_id": { "$oid": "552cd4f7d94f001f8e000001" }, "_keywords": [ "machine", "on", "start", "status" ], "created_at": "2015-04-14T08:51:03Z", "definition": { "status": "on" }, "description": "", "instruction_key": "a5ad49t441", "license_id": { ...
Request - listing alerts for a sensor curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" -d '{"sensor_key":"27ce8667143fa217b3eb9ecbedcbacdc28addt97"}' https://api.datonis.io/api/v2/sensor_alerts Response (returns alerts generated for a sensor with key mentioned above) { "total_count": 9, "page": 1, "sensor_alerts": [ { "alert_type": 0, "data": { "batch_key": "c3544tfcdd", "sensor": { "bi_directional": true, "coordinates": [ "18.5203", "73.8567" ], "description": "", "sensor_key": "27ce8667143fa217b3eb9ecbedcbacdc28addt97", "type": "Energy Meter", "meta_data": { "properties": { "voltage": { "type": "number" }, "power": { "type": "number" } }, "additionalProperties": false }, "name": "EM-101", "state": "registered", "tags_array": [ "1-Phase", "15-Amps", "Pune" ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "1-Phase,15-Amps,Pune", "last_event": null, "last_beat": 1428644239 }, "instruction": { "_id": { "$oid": "552cd506d94f001f8e000002" }, "_keywords": [ "machine", "off", "status", "stop" ], "created_at": "2015-04-14T08:51:18Z", "definition": { "status": "off" }, "description": "", "instruction_key": "6aa487t8at", "license_id": { ...
Request - listing alerts for an instruction curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" -d '{"instruction_key":"a5ad49t441"}' https://api.datonis.io/api/v2/sensor_alerts Response (returns alerts generated for a instruction with key mentioned above) { "total_count": 10, "page": 1, "sensor_alerts": [ { "alert_type": 0, "data": { "batch_key": "59751t59ef", "sensor": { "bi_directional": true, "coordinates": [ "18.5203", "73.8567" ], "description": "", "sensor_key": "16dc891e4b255735d7tafete13e6fdc412628t84", "type": "Energy Meter", "meta_data": { "properties": { "voltage": { "type": "number" }, "power": { "type": "number" } }, "additionalProperties": false }, "name": "EM-100", "state": "registered", "tags_array": [ "1-Phase", "15-Amps", "Pune" ], "traits": { "status": "green" }, "unit_of_measure": null, "alive": false, "tags": "1-Phase,15-Amps,Pune", "last_event": null, "last_beat": 1428644189 }, "instruction": { "_id": { "$oid": "552cd4f7d94f001f8e000001" }, "_keywords": [ "machine", "on", "start", "status" ], "created_at": "2015-04-14T08:51:03Z", "definition": { "status": "on" }, "description": "", "instruction_key":...
Request - listing alerts of one or more types (levels) curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" -d '{"alert_type":[3]}' https://api.datonis.io/api/v2/sensor_alerts Response (containing alerts of type 3 i.e. CRITICAL) { "total_count": 9, "page": 1, "sensor_alerts": [ { "alert_type": 3, "data": { "foo": "bar", "sensor": { "coordinates": null, "description": "A simple sensor", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "type": "SIMPLE", "meta_data": { "type": "object", "additionalProperties": false, "properties": { "cpu": { "type": "number" }, "mem": { "type": "number" } } }, "name": "S-1", "state": "registered", "tags_array": [ ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "", "last_event": 1426504617, "last_beat": 1426504613 }, "alert_type_string": "Critical" }, "message": "Example CRITICAL alert from C Agent", "sensor_alert_key": "t922tbd1dt", "timestamp": 734827, "alert_type_string": "Critical", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "sensor_name": "S-1" }, { "alert_type": 3, "data": { "foo": "bar", "sensor": { "coordinates": null, "description": "A simple sensor", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "type": "SIMPLE", ...
Returns details of the requested sensor alert
Param name | Description |
---|---|
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
Request curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:g_M23jYW-VRlOSUjC_h3Gg" https://api.datonis.io/api/v2/sensor_alerts/t922tbd1dt Response (containing details of the alert fetched) { "sensor_alert": { "alert_type": 3, "data": { "foo": "bar", "sensor": { "coordinates": null, "description": "A simple sensor", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "type": "SIMPLE", "meta_data": { "type": "object", "additionalProperties": false, "properties": { "cpu": { "type": "number" }, "mem": { "type": "number" } } }, "name": "S-1", "state": "registered", "tags_array": [ ], "traits": { }, "unit_of_measure": null, "alive": false, "tags": "", "last_event": 1426504617, "last_beat": 1426504613 }, "alert_type_string": "Critical" }, "message": "Example CRITICAL alert from C Agent", "sensor_alert_key": "t922tbd1dt", "timestamp": 734827, "alert_type_string": "Critical", "sensor_key": "f93dc59fd834td771cab48d57fae45t816b751be", "sensor_name": "S-1" } }