Sysdig Monitor

class sdcclient.SdMonitorClient(token='', sdc_url='https://app.sysdigcloud.com', ssl_verify=True, custom_headers=None)[source]
add_dashboard_panel(dashboard, panel_name, visualization, query)
clear_agents_config()
static convert_scope_string_to_expression(scope) Union[Tuple[bool, str], Tuple[bool, Any]][source]

Description Internal function to convert a filter string to a filter object to be used with dashboards.

create_access_key()
Description

Create a new access key for Sysdig Monitor/Secure

Reslut

The access keys object

create_alert(name=None, description=None, severity=None, for_atleast_s=None, condition=None, segmentby=None, segment_condition='ANY', user_filter='', notify=None, enabled=True, annotations=None, alert_obj=None, type='MANUAL') Union[Tuple[bool, str], Tuple[bool, Any]][source]

Create a threshold-based alert.

Parameters
  • name (str) – the alert name. This will appear in the Sysdig Monitor UI and in notification emails

  • description (str) – the alert description. This will appear in the Sysdig Monitor UI and in notification emails

  • severity (int) – syslog-encoded alert severity. This is a number from 0 to 7 where 0 means ‘emergency’ and 7 is ‘debug’

  • for_atleast_s (int) – the number of consecutive seconds the condition must be satisfied for the alert to fire

  • condition (int) – the alert condition, as described here https://app.sysdigcloud.com/apidocs/#!/Alerts/post_api_alerts

  • segmentby (List(str)) – a list of Sysdig Monitor segmentation criteria that can be used to apply the alert to multiple entities. For example, segmenting a CPU alert by ['host.mac', 'proc.name'] allows to apply it to any process in any machine.

  • segment_condition (str) – When :param:`segmentby` is specified (and therefore the alert will cover multiple entities) this field is used to determine when it will fire. In particular, you have two options for segment_condition: ANY (the alert will fire when at least one of the monitored entities satisfies the condition) and ALL (the alert will fire when all of the monitored entities satisfy the condition).

  • user_filter (str) – a boolean expression combining Sysdig Monitor segmentation criteria that makes it possible to reduce the scope of the alert. For example: kubernetes.namespace.name='production' and container.image='nginx'.

  • notify (str) – the type of notification you want this alert to generate. Options are EMAIL, SNS, PAGER_DUTY, SYSDIG_DUMP

  • enabled (bool) – if True, the alert will be enabled when created.

  • annotations (dict) – an optional dictionary of custom properties that you can associate to this alert for automation or management reasons.

  • alert_obj (object) – an optional fully-formed Alert object of the format returned in an “alerts” list by get_alerts() This is an alternative to creating the Alert using the individual parameters listed above.

  • type (str) – the type of the alert, MANUAL if the alert uses a normal query, PROMETHEUS if it’s PromQL

Returns

A tuple where the first parameter indicates if the call was successful, and the second parameter holds either the error as string, or the response object.

create_dashboard(name)
Description

Creates an empty dashboard. You can then add panels by using add_dashboard_panel.

Arguments
  • name: the name of the dashboard that will be created.

Success Return Value

A dictionary showing the details of the new dashboard.

Example

examples/dashboard.py

create_dashboard_from_dashboard(newdashname, templatename, filter=None, shared=False, public=False)
Description

Create a new dasboard using one of the existing dashboards as a template. You will be able to define the scope of the new dasboard.

Arguments
  • newdashname: the name of the dashboard that will be created.

  • viewname: the name of the dasboard to use as the template, as it appears in the Sysdig Monitor dashboard page.

  • filter: a boolean expression combining Sysdig Monitor segmentation criteria defines what the new dasboard will be applied to. For example: kubernetes.namespace.name=’production’ and container.image=’nginx’.

  • shared: if set to True, the new dashboard will be a shared one.

  • public: if set to True, the new dashboard will be shared with public token.

Success Return Value

A dictionary showing the details of the new dashboard.

Example

examples/create_dashboard.py

create_dashboard_from_file(dashboard_name, filename, filter=None, shared=False, public=False)
Description

Create a new dasboard using a dashboard template saved to disk. See save_dashboard_to_file() to use the file to create a dashboard (usefl to create and restore backups).

The file can contain the following JSON formats: 1. dashboard object in the format of an array element returned by get_dashboards() 2. JSON object with the following properties:

  • version: dashboards API version (e.g. ‘v2’)

  • dashboard: dashboard object in the format of an array element returned by get_dashboards()

Arguments
  • dashboard_name: the name of the dashboard that will be created.

  • filename: name of a file containing a JSON object

  • filter: a boolean expression combining Sysdig Monitor segmentation criteria defines what the new dasboard will be applied to. For example: kubernetes.namespace.name=’production’ and container.image=’nginx’.

  • shared: if set to True, the new dashboard will be a shared one.

  • public: if set to True, the new dashboard will be shared with public token.

Success Return Value

A dictionary showing the details of the new dashboard.

Example

examples/dashboard_save_load.py

create_dashboard_from_template(dashboard_name, template, scope=None, shared=False, public=False)
create_dashboard_from_view(newdashname, viewname, filter, shared=False, public=False)
Description

Create a new dasboard using one of the Sysdig Monitor views as a template. You will be able to define the scope of the new dashboard.

Arguments
  • newdashname: the name of the dashboard that will be created.

  • viewname: the name of the view to use as the template for the new dashboard. This corresponds to the name that the view has in the Explore page.

  • filter: a boolean expression combining Sysdig Monitor segmentation criteria that defines what the new dasboard will be applied to. For example: kubernetes.namespace.name=’production’ and container.image=’nginx’.

  • shared: if set to True, the new dashboard will be a shared one.

  • public: if set to True, the new dashboard will be shared with public token.

Success Return Value

A dictionary showing the details of the new dashboard.

Example

examples/create_dashboard.py

create_dashboard_with_configuration(configuration)
create_email_notification_channel(channel_name, email_recipients)
create_notification_channel(channel)
create_sysdig_capture(hostname, capture_name, duration, capture_filter='', folder='/')
Description

Create a new sysdig capture. The capture will be immediately started.

Arguments
  • hostname: the hostname of the instrumented host where the capture will be taken.

  • capture_name: the name of the capture.

  • duration: the duration of the capture, in seconds.

  • capture_filter: a sysdig filter expression.

  • folder: directory in the S3 bucket where the capture will be saved.

Success Return Value

A dictionary showing the details of the new capture.

Example

examples/create_sysdig_capture.py

create_team(name, memberships=None, filter='', description='', show='host', theme='#7BB0B2', perm_capture=False, perm_custom_events=False, perm_aws_data=False, perm_rapid_response=False)
Description

Creates a new team

Arguments
  • name: the name of the team to create.

  • memberships: dictionary of (user-name, team-role) pairs that should describe new memberships of the team.

  • filter: the scope that this team is able to access within Sysdig Monitor.

  • description: describes the team that will be created.

  • show: possible values are host, container.

  • theme: the color theme that Sysdig Monitor will use when displaying the team.

  • perm_capture: if True, this team will be allowed to take sysdig captures.

  • perm_custom_events: if True, this team will be allowed to view all custom events from every user and agent.

  • perm_aws_data: if True, this team will have access to all AWS metrics and tags, regardless of the team’s scope.

  • perm_rapid_response: if True, this team will have access rapid response feature.

Success Return Value

The newly created team.

Example

examples/user_team_mgmt.py

create_user(user_email, first_name=None, last_name=None, password=None)

Provisions a new user to use Sysdig without sending an email notification. If password is not set through this request a random one is generated for the user which requires them to reset password on first login.

Parameters
  • user_email (str) – Email of the user to provision.

  • first_name (str) – First name of the user to provision. Can be null.

  • last_name (str) – Last name of the user to provision. Can be null.

  • password (str) – Default password for the user to provision. If this is not set, a random one is generated.

Returns

The provisioned user information.

create_user_invite(user_email, first_name=None, last_name=None, system_role=None)
Description

Invites a new user to use Sysdig Monitor. This should result in an email notification to the specified address.

Arguments
  • user_email: the email address of the user that will be invited to use Sysdig Monitor

  • first_name: the first name of the user being invited

  • last_name: the last name of the user being invited

  • system_role: system-wide privilege level for this user regardless of team. specify ‘ROLE_CUSTOMER’ to create an Admin. if not specified, default is a non-Admin (‘ROLE_USER’).

Success Return Value

The newly created user.

Examples
delete_alert(alert) Union[Tuple[bool, str], Tuple[bool, Any]][source]
Description

Deletes an alert.

Arguments
  • alert: the alert dictionary as returned by get_alerts().

Success Return Value

None.

Example

examples/delete_alert.py

delete_dashboard(dashboard)
Description

Deletes a dashboard.

Arguments
  • dashboard: the dashboard object as returned by get_dashboards().

Success Return Value

None.

Example

examples/delete_dashboard.py

delete_event(event)
Description

Deletes an event.

Arguments
  • event: the event object as returned by get_events().

Success Return Value

None.

Example

examples/delete_event.py

delete_notification_channel(channel)
delete_sysdig_capture(capture_id)

Removes an existing Sysdig Capture from Monitor

Parameters

capture_id – ID of the capture to remove

Returns: A touple of (bool, error) where the first value is false if there’s an error and the second value is the error.

delete_team(name)
Description

Deletes a team from Sysdig Monitor.

Arguments
  • name: the name of the team that will be deleted from Sysdig Monitor

Example

examples/user_team_mgmt.py

delete_user(user_email)
Description

Deletes a user from Sysdig Monitor.

Arguments
  • user_email: the email address of the user that will be deleted from Sysdig Monitor

Example

examples/user_team_mgmt.py

disable_access_key(access_key)
Description

Disable an existing access key

Arguments
  • access_key: the access key to be disabled

Reslut

The access keys object

download_sysdig_capture(capture_id)
Description

Download a sysdig capture by id.

Arguments
  • capture_id: the capture id to download.

Success Return Value

The bytes of the scap

edit_team(name, memberships=None, filter=None, description=None, show=None, theme=None, perm_capture=None, perm_custom_events=None, perm_aws_data=None, perm_rapid_response=False)
Description

Edits an existing team. All arguments are optional. Team settings for any arguments unspecified will remain at their current settings.

Arguments
  • name: the name of the team to edit.

  • memberships: dictionary of (user-name, team-role) pairs that should describe new memberships of the team.

  • filter: the scope that this team is able to access within Sysdig Monitor.

  • description: describes the team that will be created.

  • show: possible values are host, container.

  • theme: the color theme that Sysdig Monitor will use when displaying the team.

  • perm_capture: if True, this team will be allowed to take sysdig captures.

  • perm_custom_events: if True, this team will be allowed to view all custom events from every user and agent.

  • perm_aws_data: if True, this team will have access to all AWS metrics and tags, regardless of the team’s scope.

  • perm_rapid_response: if True, this team will have access rapid response feature.

Success Return Value

The edited team.

Example

examples/user_team_mgmt.py

edit_user(user_email, firstName=None, lastName=None, systemRole=None)
enable_access_key(access_key)
Description

Enable an existing access key

Arguments
  • access_key: the access key to be enabled

Reslut

The access keys object

favorite_dashboard(dashboard_id, favorite)
find_dashboard_by(name=None)
Description

Finds dashboards with the specified name. You can then delete the dashboard (with delete_dashboard()) or edit panels (with add_dashboard_panel() and remove_dashboard_panel())

Arguments
  • name: the name of the dashboards to find.

Success Return Value

A list of dictionaries of dashboards matching the specified name.

Example

examples/dashboard.py

get_agents_config()
get_alerts() Union[Tuple[bool, str], Tuple[bool, Any]][source]

Retrieve the list of alerts configured by the user.

Returns

A tuple where the first parameter indicates if the call was successful, and the second parameter holds either the error as string, or the response object.

Examples

>>> ok, res = client.get_alerts()
>>> for alert in res['alerts']:
>>>     print(f'enabled: {str(alert["enabled"])}, name: {alert["name"]}' )
get_connected_agents()
Description

Return the agents currently connected to Sysdig Monitor for the current user.

Success Return Value

A list of the agents with all their attributes.

get_dashboard(dashboard_id)
Description

Return a dashboard with the pased in ID. This includes the dashboards created by the user and the ones shared with them by other users.

Success Return Value

A dictionary containing the requested dashboard data.

Example

examples/dashboard_basic_crud.py

get_dashboards(light=True)

Return the list of dashboards available under the given user account. This includes the dashboards created by the user and the ones shared with her by other users. Since every user has multiple tokens – one per team they are assigned to – and dashboards are scoped per team, in order to download all the dashboards from a user account, all the tokens must be specified.

Parameters

light (bool) – If it’s true, only a small portion of information will be retrieved, otherwise all the information from the dashboards will be retrieved. If the retrieved dashboards are going to be restored in the future, then this parameter must be false.

Returns

The list of the dashboards visible for the given token.

See also

create_dashboard_with_configuration()

Examples

>>> ok, res = client.get_dashboards(light=False)
>>> for dashboard in res["dashboards"]:
>>>     print(dashboard["name"])
get_data(metrics, start_ts, end_ts=0, sampling_s=0, filter='', datasource_type='host', paging=None)
Description

Export metric data (both time-series and table-based).

Arguments
  • metrics: a list of dictionaries, specifying the metrics and grouping keys that the query will return. A metric is any of the entries that can be found in the Metrics section of the Explore page in Sysdig Monitor. Metric entries require an aggregations section specifying how to aggregate the metric across time and containers/hosts. A grouping key is any of the entries that can be found in the Show or Segment By sections of the Explore page in Sysdig Monitor. These entries are used to apply single or hierarchical segmentation to the returned data and don’t require the aggregations section. Refer to the Example link below for ready-to-use code snippets.

  • start_ts: the UTC time (in seconds) of the beginning of the data window. A negative value can be optionally used to indicate a relative time in the past from now. For example, -3600 means “one hour ago”.

  • end_ts: the UTC time (in seconds) of the end of the data window, or 0 to indicate “now”. A negative value can also be optionally used to indicate a relative time in the past from now. For example, -3600 means “one hour ago”.

  • sampling_s: the duration of the samples that will be returned. 0 means that the whole data will be returned as a single sample.

  • filter: a boolean expression combining Sysdig Monitor segmentation criteria that defines what the query will be applied to. For example: kubernetes.namespace.name=’production’ and container.image=’nginx’.

  • datasource_type: specify the metric source for the request, can be container or host. Most metrics, for example cpu.used.percent or memory.bytes.used, are reported by both hosts and containers. By default, host metrics are used, but if the request contains a container-specific grouping key in the metric list/filter (e.g. container.name), then the container source is used. In cases where grouping keys are missing or apply to both hosts and containers (e.g. tag.Name), datasource_type can be explicitly set to avoid any ambiguity and allow the user to select precisely what kind of data should be used for the request. examples/get_data_datasource.py contains a few examples that should clarify the use of this argument.

  • paging: if segmentation of the query generates values for several different entities (e.g. containers/hosts), this parameter specifies which to include in the returned result. It’s specified as a dictionary of inclusive values for from and to with the default being { "from": 0, "to": 9 }, which will return values for the “top 10” entities. The meaning of “top” is query-dependent, based on points having been sorted via the specified group aggregation, with the results sorted in ascending order if the group aggregation is min or none, and descending order otherwise.

Success Return Value

A dictionary with the requested data. Data is organized in a list of time samples, each of which includes a UTC timestamp and a list of values, whose content and order reflect what was specified in the metrics argument.

Examples
get_data_retention_info()
Description

Return the list of data retention intervals, with beginning and end UTC time for each of them. Sysdig Monitor performs rollups of the data it stores. This means that data is stored at different time granularities depending on how far back in time it is. This call can be used to know what precision you can expect before you make a call to get_data().

Success Return Value

A dictionary containing the list of available sampling intervals.

Example

examples/print_data_retention_info.py

get_event(id)

Retrieve an event using the ID :param id: ID of the event to retrieve :type id: str

Returns

A tuple where the first parameter indicates if the call was successful, and the second parameter holds either the error as string, or the event matching this ID.

Examples

>>> from sdcclient.monitor import EventsClientV2
>>> client = EventsClientV2(token=SECURE_TOKEN)
>>> ok, res = client.get_event(id='2343214984')
>>> if ok:
>>>     print(res["event"])
get_events(name=None, category=None, direction='before', status=None, limit=100, pivot=None, from_s=None, to_s=None)
Description

Returns the list of Sysdig Monitor events.

Arguments
  • name: filter events by name. Default: None.

  • category: filter events by category. Default: [‘alert’, ‘custom’, ‘docker’, ‘containerd’, ‘kubernetes’].

  • direction: orders the list of events. Valid values: “before”, “after”. Default: “before”.

  • status: status of the event as list. Default: [‘triggered’, ‘resolved’, ‘acknowledged’, ‘unacknowledged’]

  • limit: max number of events to retrieve. Default: 100.

  • pivot: event id to use as pivot. Default: None.

  • from_s: the unix timestamp in milliseconds or datetime object for the beginning of the events. Default: None.

  • to_s: the unix timestamp in milliseconds or datetime object for the end of the events. Default: None.

Success Return Value

A dictionary containing the list of events.

Example

examples/list_events.py

get_explore_grouping_hierarchy() Union[Tuple[bool, str], Tuple[bool, Any]][source]
Description

Return the user’s current grouping hierarchy as visible in the Explore tab of Sysdig Monitor.

Success Return Value

A list containing the list of the user’s Explore grouping criteria.

Example

examples/print_explore_grouping.py

get_metrics() Union[Tuple[bool, str], Tuple[bool, Any]][source]
Description

Return the metric list that can be used for data requests/alerts/dashboards.

Success Return Value

A dictionary containing the list of available metrics.

Example

examples/list_metrics.py

get_n_connected_agents()
Description

Return the number of agents currently connected to Sysdig Monitor for the current user.

Success Return Value

An integer number.

get_notification_channel(id)
get_notification_ids(channels=None)
Description

Get an array of all configured Notification Channel IDs, or a filtered subset of them.

Arguments
  • channels: an optional array of dictionaries to limit the set of Notification Channel IDs returned. If not specified, IDs for all configured Notification Channels are returned. Each dictionary contains a type field that can be one of the available types of Notification Channel (EMAIL, SNS, PAGER_DUTY, SLACK, OPSGENIE, VICTOROPS, WEBHOOK) as well as additional elements specific to each channel type.

Success Return Value

An array of Notification Channel IDs (integers).

Examples
get_notifications(from_ts, to_ts, state=None, resolved=None) Union[Tuple[bool, str], Tuple[bool, Any]][source]

Returns the list of Sysdig Monitor alert notifications.

Parameters
  • from_ts (int) – filter events by start time. Timestamp format is in UTC (seconds).

  • to_ts (int) – filter events by start time. Timestamp format is in UTC (seconds).

  • state (str) – filter events by alert state. Supported values are OK and ACTIVE.

  • resolved (str) – filter events by resolution status. Supported values are “True” and “False”.

Returns

A tuple where the first parameter indicates if the call was successful, and the second parameter holds either the error as string, or the response object.

Examples

>>> # Get the notifications in the last day
>>> ok, res = client.get_notifications(from_ts=int(time.time() - 86400), to_ts=int(time.time()))
>>> # Get the notifications in the last day and active state
>>> ok, res = client.get_notifications(from_ts=int(time.time() - 86400), to_ts=int(time.time()), state='ACTIVE')
>>> # Get the notifications in the last day and active state
>>> ok, res = client.get_notifications(from_ts=int(time.time() - 86400), to_ts=int(time.time()), state='OK')
>>> # Get the notifications in the last day and resolved state
>>> ok, res = client.get_notifications(from_ts=int(time.time() - 86400), to_ts=int(time.time()), resolved=True)
get_sysdig_captures(from_sec=None, to_sec=None, scope_filter=None)
Description

Returns the list of sysdig captures for the user.

Arguments
  • from_sec: the start of the timerange for which to get the captures

  • end_sec: the end of the timerange for which to get the captures

  • scope_filter: this is a SysdigMonitor-like filter (e.g ‘container.image=ubuntu’). When provided, events are filtered by their scope, so only a subset will be returned (e.g. ‘container.image=ubuntu’ will provide only events that have happened on an ubuntu container).

Success Return Value

A dictionary containing the list of captures.

Example

examples/list_sysdig_captures.py

get_team(name)
Description

Return the team with the specified team name, if it is present.

Arguments
  • name: the name of the team to return

Success Return Value

The requested team.

Example

examples/user_team_mgmt.py

get_team_by_id(id)
Description

Return the team with the specified team ID, if it is present.

Arguments
  • id: the ID of the team to return

Success Return Value

The requested team.

Example

examples/user_team_mgmt.py

get_team_ids(teams)
get_teams(team_filter='', product_filter='')
Description

Return the set of teams that match the filter specified. The team_filter should be a substring of the names of the teams to be returned.

Arguments
  • team_filter: the team filter to match when returning the list of teams

  • product_filter: the product to match when returning the list of teams (SDC-Monitor, SDS-secure)

Success Return Value

The teams that match the filter.

get_topology_map(grouping_hierarchy, time_window_s, sampling_time_s)
get_user(user_email)
get_user_api_token(username, teamname)
get_user_ids(users)
get_user_info()
Description

Get details about the current user.

Success Return Value

A dictionary containing information about the user, for example its email and the maximum number of agents it can install.

Example

examples/print_user_info.py

get_user_token()
Description

Return the API token of the current user.

Success Return Value

A string containing the user token.

get_users()
Description

Return a list containing details about all users in the Sysdig Monitor environment. The API token must have Admin rights for this to succeed.

Success Return Value

A list user objects

get_view(name)
get_views_list()
lasterr = None
list_access_keys()
Description

List all the access keys enabled and disabled for this instance of Sysdig Monitor/Secure

Reslut

A list of access keys objects

Example

examples/list_access_keys.py

list_memberships(team)
Description

List all memberships for specified team.

Arguments
  • team: the name of the team for which we want to see memberships

Result

Dictionary of (user-name, team-role) pairs that should describe memberships of the team.

Example

examples/user_team_mgmt_extended.py

list_notification_channels()
Description

List all configured Notification Channels

Arguments

none

Success Return Value

A JSON representation of all the notification channels

poll_sysdig_capture(capture)
Description

Fetch the updated state of a sysdig capture. Can be used to poll the status of a capture that has been previously created and started with create_sysdig_capture().

Arguments
  • capture: the capture object as returned by get_sysdig_captures() or create_sysdig_capture().

Success Return Value

A dictionary showing the updated details of the capture. Use the status field to check the progress of a capture.

Example

examples/create_sysdig_capture.py

post_event(name, description=None, severity=None, event_filter=None, tags=None)
Description

Send an event to Sysdig Monitor. The events you post are available in the Events tab in the Sysdig Monitor UI and can be overlied to charts.

Arguments
  • name: the name of the new event.

  • description: a longer description offering detailed information about the event.

  • severity: syslog style from 0 (high) to 7 (low).

  • event_filter: metadata, in Sysdig Monitor format, of nodes to associate with the event, e.g. host.hostName = 'ip-10-1-1-1' and container.name = 'foo'.

  • tags: a list of key-value dictionaries that can be used to tag the event. Can be used for filtering/segmenting purposes in Sysdig Monitor.

Success Return Value

A dictionary describing the new event.

Examples
remove_dashboard_panel(dashboard, panel_id)
remove_memberships(team, users)
Description

Remove user memberships from specified team.

Arguments
  • team: the name of the team from which user memberships are removed

  • users: list of usernames which should be removed from team

Example

examples/user_team_mgmt_extended.py

save_dashboard_to_file(dashboard, filename)
Description

Save a dashboard to disk. See create_dashboard_from_file() to use the file to create a dashboard (usefl to create and restore backups).

The file will contain a JSON object with the following properties: * version: dashboards API version (e.g. ‘v2’) * dashboard: dashboard object in the format of an array element returned by get_dashboards()

Arguments
  • dashboard: dashboard object in the format of an array element returned by get_dashboards()

  • filename: name of a file that will contain a JSON object

Example

examples/dashboard_save_load.py

save_memberships(team, memberships)
Description

Create new user team memberships or update existing ones.

Arguments
  • team: the name of the team for which we are creating new memberships

  • memberships: dictionary of (user-name, team-role) pairs that should describe new memberships

Example

examples/user_team_mgmt_extended.py

set_agents_config(config)
set_explore_grouping_hierarchy(new_hierarchy) Union[Tuple[bool, str], Tuple[bool, Any]][source]
Description

Changes the grouping hierarchy in the Explore panel of the current user.

Arguments
  • new_hierarchy: a list of sysdig segmentation metrics indicating the new grouping hierarchy.

share_dashboard_with_all_teams(dashboard, mode='r')
share_dashboard_with_team(dashboard, team_id, mode='r')
unshare_dashboard(dashboard)
update_alert(alert) Union[Tuple[bool, str], Tuple[bool, Any]][source]

Update a modified threshold-based alert.

Parameters

alert (object) – one modified alert object of the same format as those in the list returned by get_alerts().

Returns

A tuple where the first parameter indicates if the call was successful, and the second parameter holds either the error as string, or updated alert.

Examples

>>> ok, res = client.get_alerts()
>>> if not ok:
>>>     sys.exit(1)
>>> for alert in res['alerts']:
>>>     if alert['name'] == alert_name:
>>>         alert['timespan'] = alert['timespan'] * 2  # Note: Expressed in seconds * 1000000
>>>         ok, res_update = client.update_alert(alert)
update_dashboard(dashboard_data)
Description

Updates dashboard with provided in data. Please note that the dictionary will require a valid ID and version field to work as expected.

Success Return Value

A dictionary containing the updated dashboard data.

Example

examples/dashboard_basic_crud.py

update_notification_channel(channel)
update_notification_resolution(notification, resolved) Union[Tuple[bool, str], Tuple[bool, Any]][source]

Updates the resolution status of an alert notification.

Parameters
  • notification (object) – notification object as returned by get_notifications().

  • resolved (str) – new resolution status. Supported values are True and False.

Returns

A tuple where the first parameter indicates if the call was successful, and the second parameter holds either the error as string, or the response object.

Examples

>>> # Get the unresolved notifications in the last day
>>> ok, res = sdclient.get_notifications(from_ts=int(time.time() - int(num_days_to_resolve) * 86400), to_ts=int(time.time()), resolved=False)
>>> # Resolve all of them
>>> for notification in notifications:
>>>     ok, res = sdclient.update_notification_resolution(notification, True)