This module is a wrapper around the Sysdig Monitor/Sysdig Secure APIs. It exposes most of the sysdig REST API functionality as an easy to use and easy to install Python interface.
There are more details the Sysdig SDK Python documentation.
Installation
Automatic with PyPI
$ pip install sdcclient
Manual (development only)
This method requires Poetry installed
$ git clone https://github.com/sysdiglabs/sysdig-sdk-python.git
$ cd python-sdc-client
$ poetry install
Usage
Note: in order to use this API you must obtain a Sysdig Monitor/Secure API token. You can get your user’s token in the Sysdig Monitor API section of the settings page for monitor or secure.
The library exports two classes, SdMonitorClient
and SdSecureClient
that
are used to connect to Sysdig Monitor/Secure and execute actions.
They can be instantiated like this:
from sdcclient import SdMonitorClient
api_token = "MY_API_TOKEN"
#
# Instantiate the Sysdig Monitor client
#
client = SdMonitorClient(api_token)
For backwards compatibility purposes, a third class SdcClient
is exported which is an alias of SdMonitorClient
.
Once instantiated, all the methods documented below can be called on the object.
On-Premises Installs
For On-Premises Sysdig Monitor installs, additional configuration is necessary to point to your API server rather than the default SaaS-based one, and also to easily connect when using a self-signed certificate for SSL. One way to handle this is by setting environment variables before running your Python scripts:
export SDC_URL='https://<YOUR-API-SERVER-HOSTNAME-OR-IP>'
export SDC_SSL_VERIFY='false'
Alternatively, you can specify the additional arguments in your Python scripts as you instantiate the SDC client:
client = SdMonitorClient(api_token, sdc_url='https://<YOUR-API-SERVER-HOSTNAME-OR-IP>', ssl_verify=False)