troubleshooting

The following methods allow for interaction with the ZDX Troubleshooting API endpoints.

Methods are accessible via zdx.troubleshooting

Copyright (c) 2023, Zscaler Inc.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

class TroubleshootingAPI

Bases: APIClient

delete_analysis(analysis_id)

Stop the score analysis that is currently running.

Parameters:

analysis_id (str) – The unique ID for the device.

Returns:

The analysis ID that was deleted.

Return type:

str

Examples

Delete a single deeptrace for a device.

>>> _, zscaler_resp, err = client.zdx.troubleshooting.delete_analysis('123456789')
... if err:
...     print(f"Error deleting trace: {err}")
...     return
... print(f"Trace Analysis with ID {trace_id} deleted successfully.")
delete_deeptrace(device_id, trace_id)

Deletes a single deeptrace session and associated data for a specific device.

Parameters:
  • device_id (str) – The unique ID for the device.

  • trace_id (str) – The unique ID for the deeptrace.

Returns:

The trace ID that was deleted.

Return type:

str

Examples

Delete a single deeptrace for a device.

>>> _, zscaler_resp, err = client.zdx.troubleshooting.delete_deeptrace('123456789', '987654321')
... if err:
...     print(f"Error deleting trace: {err}")
...     return
... print(f"Trace with ID {trace_id} deleted successfully.")
get_analysis(analysis_id)

Returns status of the score analysis (e.g., progress or results). :param device_id: The unique ID for the device. :type device_id: str :param trace_id: The unique ID for the deeptrace. :type trace_id: str

Returns:

The deeptrace health metrics.

Return type:

Tuple

Examples

Print health metrics for a deeptrace.

>>> trace_analysis_list, _, err = client.zdx.troubleshooting.get_analysis('132559212', '342821739939272')
...  if err:
...     print(f"Error listing trace analysis list: {err}")
...     return
... for trace in trace_analysis_list:
...     print(trace.as_dict())
get_deeptrace(device_id, trace_id)

Returns information on a single deeptrace for a specific device.

Parameters:
  • device_id (str) – The unique ID for the device.

  • trace_id (str) – The unique ID for the deeptrace.

Returns:

The deeptrace resource record.

Return type:

Tuple

Examples

Print a single deeptrace for a device.

>>> device_trace, _, error = client.zdx.troubleshooting.get_deeptrace('132559212', '342941739947287')
... if error:
...         print(f"Error: {error}")
... else:
...         for trace in device_trace:
...             print(trace.as_dict())
get_deeptrace_cloudpath(device_id, trace_id)

Returns cloudpath for a specific deeptrace.

Parameters:
  • device_id (str) – The unique ID for the device.

  • trace_id (str) – The unique ID for the deeptrace.

Returns:

The deeptrace cloudpath.

Return type:

Tuple

Examples

Print cloudpath for a deeptrace.

>>> cloud_path_list, _, err = client.zdx.troubleshooting.get_deeptrace_cloudpath('132559212', '342941739947287')
... if err:
...     print(f"Error listing cloud path: {err}")
...     return
... for process in cloud_path_list:
...     print(process.as_dict())
get_deeptrace_cloudpath_metrics(device_id, trace_id)

Returns cloudpath metrics for a specific deeptrace.

Parameters:
  • device_id (str) – The unique ID for the device.

  • trace_id (str) – The unique ID for the deeptrace.

Returns:

The deeptrace cloudpath metrics.

Return type:

Tuple

Examples

Print cloudpath metrics for a deeptrace.

>>> path_matric, _, err = client.zdx.troubleshooting.get_deeptrace_cloudpath_metrics(
    '132559212', '342941739947287')
... if err:
...     print(f"Error listing cloud path metrics: {err}")
...     return
... for process in path_matric:
...     print(process.as_dict())
get_deeptrace_events(device_id, trace_id)

Returns events for a specific deeptrace.

Parameters:
  • device_id (str) – The unique ID for the device.

  • trace_id (str) – The unique ID for the deeptrace.

Returns:

The deeptrace events.

Return type:

Tuple

Examples

Print events for a deeptrace.

>>> trace_events_list, _, err = client.zdx.troubleshooting.get_deeptrace_events('132559212', '342941739947287')
... if err:
...     print(f"Error listing trace event list: {err}")
...     return
... for event in trace_events_list:
...     print(event.as_dict())
get_deeptrace_health_metrics(device_id, trace_id)

Returns health metrics for a specific deeptrace.

Parameters:
  • device_id (str) – The unique ID for the device.

  • trace_id (str) – The unique ID for the deeptrace.

Returns:

The deeptrace health metrics.

Return type:

Tuple

Examples

Print health metrics for a deeptrace.

>>> health_metrics, _, err = client.zdx.troubleshooting.get_deeptrace_health_metrics(
    '132559212', '342941739947287')
... if err:
...     print(f"Error listing health metrics: {err}")
...     return
... for metric in health_metrics:
...     print(metric.as_dict())
get_deeptrace_webprobe_metrics(device_id, trace_id)

Returns web probe metrics for a specific deeptrace.

Parameters:
  • device_id (str) – The unique ID for the device.

  • trace_id (str) – The unique ID for the deeptrace.

Returns:

The deeptrace web probe metrics.

Return type:

Tuple

Examples

Print web probe metrics for a deeptrace.

>>> metrics_list, _, err = client.zdx.troubleshooting.get_deeptrace_webprobe_metrics(
    '132559212', '342941739947287')
... if err:
...     print(f"Error listing web probe metrics: {err}")
...     return
... for metric in metrics_list:
...     print(metric.as_dict())
list_deeptraces(device_id)

Returns a list of all deep traces for a specific device.

Parameters:

device_id (str) – The unique ID for the device.

Returns:

Tuple:: The list of deep traces for the device.

Examples

Print a list of deep traces for a device.

>>> trace_list, _, err = client.zdx.troubleshooting.list_deeptraces('132559212')
... if err:
...     print(f"Error listing deep traces: {err}")
...     return
... for trace in trace_list:
...     print(trace.as_dict())
list_top_processes(device_id, trace_id)

Returns a list of all deep traces for a specific device.

Parameters:

device_id (str) – The unique ID for the device.

Returns:

Tuple:: The list of deep traces for the device.

Examples

Print a list of deep traces for a device.

>>> processes_list, _, err = client.zdx.troubleshooting.list_top_processes('132559212', '342821739939272')
... if err:
...     print(f"Error listing top processes: {err}")
...     return
... for process in processes_list:
...     print(process.as_dict())
start_analysis(**kwargs)

Starts a ZDX Score analysis on a device for a specific application.

Parameters:
  • device_id (str) – The unique ID for the device.

  • app_id (str) – The unique ID for the application.

  • t0 (int)

  • t1 (int)

Returns:

The deeptrace resource record.

Return type:

Tuple

Examples

Start a deeptrace for a device.

>>> start_analysis, response, error = client.zdx.troubleshooting.start_analysis(
...     device_id='132559212',
...     app_id='1',
... )
... if error:
...     print(f"Error starting analysis: {error}")
...     return
... print(f"Analysis Started successfully: {start_analysis.as_dict()}")
start_deeptrace(device_id, **kwargs)

Starts a deep trace for a specific device and application.

Parameters:
  • device_id (str) – The unique ID for the device.

  • app_id (str) – The unique ID for the application.

  • session_name (str) – The name of the deeptrace session.

Keyword Arguments:
  • web_probe_id (str) – The unique ID for the Web probe.

  • cloudpath_probe_id (str) – The unique ID for the Cloudpath probe.

  • session_length_minutes (int) – The duration of the deeptrace session in minutes. Defaults to 5. Supported values: 5, 15, 30, 60

  • probe_device (bool) – Whether to probe the device.

Returns:

The deeptrace resource record.

Return type:

Tuple

Examples

Start a deeptrace for a device.

>>> start_trace, response, error = client.zdx.troubleshooting.start_deeptrace(
...     device_id='132559212',
...     session_name='DeepTrace01',
...     session_length_minutes=5,
...     probe_device=True
)

… if error: … print(f”Error starting trace: {error}”) … return … print(f”Trace Started successfully: {start_trace.as_dict()}”)