Alerts
Note : You can use our Python client to create, list, delete, update and restore Alerts https://github.com/draios/python-sdc-client/tree/master/examples
Create an alert
URL to Python Script: https://github.com/draios/python-sdc-client/blob/master/examples/create_alert.py
Update an alert
URL to Python Script: https://github.com/draios/python-sdc-client/blob/master/examples/update_alert.py
Get list of alerts
URL to Python Script: https://github.com/draios/python-sdc-client/blob/master/examples/list_alerts.py
Details of the API:
URL: GET /api/alerts
Request parameters: None
Response parameters
alerts
: List of alert items
Get alert
URL: GET /api/alert/:id
Request parameters: None
Response parameters
id
: Alert IDtype
: Type of alert; Valid values are:MANUAL
for manual alertsBASELINE
for baseline alertsHOST_COMPARISON
for host comparison alerts
name
: Name of the alert; Note that alert names must be uniqueenabled
:true
if the alert is being processed and events can fire;false
otherwisefilter
: String-encoded filter of the alert; The filter can be used to select nodes and/or entitiescondition
: Valid for manual alerts only; Configures the threshold for the alertsegmentBy
: Segmentation to apply to condition, if neededsegmentCondition
: IfsegmentBy
is set, it configures whether alert events will be triggered when all segments reach the threshold or at least one does. The format is an object with atype
property withALL
orANY
respectively (e.g.{ "type": "ANY" }
timespan
: Number of microseconds; Minimum time interval for which the alert condition must be met before the alert will fire a event; Minimum value is 60000000 (1 minute) and values must be multiple of 60000000 (1 minute)severity
:null
to instruct the alert to set event severity automatically, a number from 0 (emergency) to 7 (debug) to set a manual severitynotificationChannelIds
: List of notification channel identifiers;
Note: Notifications must be configured and enabled globally in the Settings > Notification page of Sysdig Cloud
version
: Revision version of the alert configurationcreatedOn
: Unix-timestamp of time when the alert was createdmodifiedOn
: Unix-timestamp of time when the alert was last modifiednotificationCount
: Number of events fired for the alert during the past 2 weeks
Errors
404 Not Found
if the alert ID is not found400 NotificationChannelId: {id} does not exist
if the notification channel id specified in thenotificationChannelIds
property does not exist
Example
GET /api/alerts/123
{
"alert": {
"id": 123,
"version": 7,
"createdOn": 1459198751000,
"modifiedOn": 1460994864000,
"type": "MANUAL",
"name": "My Alert",
"enabled": true,
"filter": "cloudProvider.tag.Name = \"clients\"",
"severity": 7,
"timespan": 60000000,
"notificationCount": 1,
"segmentBy": [ "agent.tag.infrastructure" ],
"segmentCondition": {
"type": "ANY"
},
"condition": "max(sum(memory.used.percent)) >= 1",
"sysdigCapture" : {
"enabled": true,
"name": "testName",
"filters": "test",
"duration": 104857600,
"type": "LOCAL",
"bucketName": "bucketName",
"folder" : "folder"
}
}
}
Delete an alert
URL to Python Script: https://github.com/draios/python-sdc-client/blob/master/examples/delete_alert.py
Restore alerts
URL to Python Script: https://github.com/draios/python-sdc-client/blob/master/examples/restore_alerts.py