### Example: get_device_instance_graph_data_only_by_instance_id (Python) Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md Shows the initial setup for calling the `get_device_instance_graph_data_only_by_instance_id` API method in Python. It covers configuring API key authorization and creating an instance of the LogicMonitor API client. Note that the provided code snippet is incomplete and only shows the setup phase. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) ``` -------------------------------- ### Getting Website Checkpoint List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows the initial setup for retrieving a list of website checkpoints using the LogicMonitor Python SDK. It includes configuring API key authorization and creating an API client instance before making the API call. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Get Alert List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows the initial setup for retrieving a list of alerts using the `get_alert_list` method of the LogicMonitor Python SDK, including API key authorization configuration. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Initializing LogicMonitor SDK Client for Deleting Device in Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This snippet begins the demonstration of deleting a device by its ID using the LogicMonitor Python SDK. It shows the initial setup for API key authorization and client initialization, which is common across these examples. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Get All API Tokens - LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to fetch a paginated list of API tokens across all users in LogicMonitor using the Python SDK. It includes setup for API key authorization, parameter definition for filtering and pagination, and error handling for API calls. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) type = 'type_example' # str | (optional) permission = 'permission_example' # str | (optional) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get a list of api tokens across users api_response = api_instance.get_api_token_list(type=type, permission=permission, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_api_token_list: %s\n" % e) ``` -------------------------------- ### Importing Data Source via XML using LogicMonitor SDK Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This partial example demonstrates the initial setup for importing a data source into LogicMonitor using an XML file via the Python SDK. It shows how to configure API key authentication and create an API client instance before performing the import operation. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### GET get_collector_installer Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md Retrieves a Collector installer package for a specific Collector ID and operating system/architecture using a GET request. ```HTTP GET /setting/collector/collectors/{collectorId}/installers/{osAndArch} ``` -------------------------------- ### Getting Data Source Overview Graph List using LogicMonitor SDK Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to fetch a list of data source overview graphs for a given data source ID (`ds_id`). It includes configuration for API key authorization and demonstrates handling pagination and filtering options. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) ds_id = 56 # int | fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get datasource overview graph list api_response = api_instance.get_data_source_overview_graph_list(ds_id, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_data_source_overview_graph_list: %s\n" % e) ``` -------------------------------- ### Listing Reports using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This snippet provides a Python example for retrieving a paginated list of reports from LogicMonitor. It covers API key setup, client initialization, and demonstrates the use of optional parameters (fields, size, offset, filter) for filtering and pagination. API exception handling is included. ```Python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get report list api_response = api_instance.get_report_list(fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_report_list: %s\n" % e) ``` -------------------------------- ### Collecting Device Config using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This code demonstrates how to collect configuration data for a specific device using the LogicMonitor Python SDK. It configures API key authorization and initializes the API client. The example shows the setup but the API call itself is not fully present in the provided snippet. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Retrieving Device Alert Settings using Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This Python example demonstrates how to use the LogicMonitor SDK to fetch a paginated list of alert settings for a specific device. It shows how to configure API key authorization, create an API instance, and call the get_device_datasource_instance_alert_setting_list_of_device method with required and optional parameters like device_id, start, end, netflow_filter, size, and offset. The response is printed, and potential API exceptions are caught. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) device_id = 56 # int | start = 789 # int | (optional) end = 789 # int | (optional) netflow_filter = 'netflow_filter_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) try: # get a list of alert settings for a device api_response = api_instance.get_device_datasource_instance_alert_setting_list_of_device(device_id, start=start, end=end, netflow_filter=netflow_filter, size=size, offset=offset) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_device_datasource_instance_alert_setting_list_of_device: %s\n" % e) ``` -------------------------------- ### Get Website List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to retrieve a paginated list of websites using the LogicMonitor Python SDK. It includes configuring API key authentication, creating an API instance, calling the `get_website_list` method with optional parameters like `collector_ids`, and handling potential API exceptions. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) collector_ids = 'collector_ids_example' # str | (optional) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get website list api_response = api_instance.get_website_list(collector_ids=collector_ids, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_website_list: %s\n" % e) ``` -------------------------------- ### Get OpsNote List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This complete example demonstrates configuring API key authentication, initializing the LogicMonitor API client, and calling the `get_ops_note_list` method. It shows how to use optional parameters like `fields`, `size`, `offset`, and `filter` for pagination and filtering, and includes necessary imports and error handling. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | Filter the response based on tags, createdBy, happenedOn, monitorObjectGroups, monitorObjectNames, or _all field values (optional) try: # get opsnote list api_response = api_instance.get_ops_note_list(fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_ops_note_list: %s\n" % e) ``` -------------------------------- ### Get Device Instance List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to fetch a paginated list of device instances for a given device ID using the `get_device_instance_list` method. It requires the device ID and supports various optional parameters for filtering and pagination. Includes basic error handling. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) id = 56 # int | start = 789 # int | (optional) end = 789 # int | (optional) netflow_filter = 'netflow_filter_example' # str | (optional) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get device instance list api_response = api_instance.get_device_instance_list(id, start=start, end=end, netflow_filter=netflow_filter, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_device_instance_list: %s\n" % e) ``` -------------------------------- ### Getting SDT List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to retrieve a list of all SDTs using the LogicMonitor Python SDK. It covers API key configuration, API instance creation, and calling the `get_sdt_list` method with optional filtering and pagination parameters. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException rom pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get SDT list api_response = api_instance.get_sdt_list(fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_sdt_list: %s\n" % e) ``` -------------------------------- ### Getting Metrics Usage LogicMonitor SDK Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to fetch the current metrics usage data via the LogicMonitor Python SDK. It requires API key authorization and does not take any parameters. The API call returns a `Usage` object containing the metrics usage details. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) try: # get metrics usage api_response = api_instance.get_metrics_usage() pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_metrics_usage: %s\n" % e) ``` -------------------------------- ### List Cluster Alert Configurations - LogicMonitor SDK - Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to retrieve a paginated list of cluster alert configurations for a specific device group. It includes API key setup, API client initialization, setting the required `device_group_id` and optional pagination/filtering parameters (`fields`, `size`, `offset`, `filter`), and calling the `get_device_group_cluster_alert_conf_list` method with error handling. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) device_group_id = 56 # int | fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get a list of cluster alert configurations for a device group api_response = api_instance.get_device_group_cluster_alert_conf_list(device_group_id, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_device_group_cluster_alert_conf_list: %s\n" % e) ``` -------------------------------- ### Getting Website SDT History using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to retrieve the SDT history for a specific website using the LogicMonitor Python SDK. It shows how to configure API key authorization, create an API instance, and call the `get_sdt_history_by_website_id` method with required and optional parameters. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) id = 56 # int | fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get SDT history for the website (Response may contain extra fields depending upon the type of SDT) api_response = api_instance.get_sdt_history_by_website_id(id, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_sdt_history_by_website_id: %s\n" % e) ``` -------------------------------- ### Get Website Group List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to retrieve a paginated list of website groups using the LogicMonitor Python SDK. It shows how to configure API key authentication, create an API instance, call the `get_website_group_list` method with optional parameters, and handle potential API exceptions. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get website group list api_response = api_instance.get_website_group_list(fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_website_group_list: %s\n" % e) ``` -------------------------------- ### Querying Website SDTs using LogicMonitor SDK Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to fetch a list of Scheduled Down Times (SDTs) for a website using its ID with the LogicMonitor Python SDK. It includes API key configuration, parameter setup (ID, fields, size, offset, filter), and basic exception handling for API calls. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) id = 56 # int | fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get a list of SDTs for a website api_response = api_instance.get_website_sdt_list_by_website_id(id, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_website_sdt_list_by_website_id: %s\n" % e) ``` -------------------------------- ### Adding Website using LogicMonitor SDK Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md Demonstrates how to configure API key authentication and initiate the process of adding a new website monitor via the LogicMonitor API using the `add_website` method. Requires a `Website` object as the request body. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Retrieving Log Retention List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to retrieve the list of log retention settings from LogicMonitor using the Python SDK. It includes the necessary imports and the start of the API call setup. ```Python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint ``` -------------------------------- ### Updating LogicMonitor Website by ID (Python) Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md Demonstrates the initial setup for updating a LogicMonitor website using its ID and a Website object. It configures API key authorization and initializes the API client. The code snippet is incomplete, showing only the setup part. Requires the `logicmonitor_sdk` library and API key configuration. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Download LogicMonitor Collector Installer - Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This snippet demonstrates how to use the LogicMonitor SDK for Python to download a specific collector installer file. It initializes the API client, sets required and optional parameters like collector ID, OS/architecture, version, size, and handles potential API exceptions during the download process. ```python # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) collector_id = 56 # int | os_and_arch = 'os_and_arch_example' # str | collector_version = 56 # int | The version of the installer you'd like to download. This defaults to the latest GD Collector, unless useEA is true (optional) token = 'token_example' # str | (optional) monitor_others = true # bool | (optional) (default to true) collector_size = 'medium' # str | The size of the Collector you'd like to install. Options are nano, small (requires 2GB memory), medium (requires 4GB memory), large (requires 8GB memory), extra large (requires 16GB memory), double extra large (requires 32GB memory). Requires collector version 22.180 or higher. Defaults to small (optional) (default to medium) use_ea = false # bool | If true, the latest EA Collector version will be used. Defaults to false (optional) (default to false) try: # get collector installer api_response = api_instance.get_collector_installer(collector_id, os_and_arch, collector_version=collector_version, token=token, monitor_others=monitor_others, collector_size=collector_size, use_ea=use_ea) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_collector_installer: %s\n" % e) ``` -------------------------------- ### Testing SaaS Account Configuration - Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to test a SaaS account configuration using the LogicMonitor Python SDK. It shows how to initialize the API client, create the request body, make the API call, and handle potential API exceptions. ```python # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) body = logicmonitor_sdk.RestSaaSAccountTestV3() # RestSaaSAccountTestV3 | try: # test SaaS account api_response = api_instance.test_saa_s_account(body) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->test_saa_s_account: %s\n" % e) ``` -------------------------------- ### Listing Device Config Source Configs - LogicMonitor SDK - Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to retrieve a list of detailed configuration information for a specific device, config source (hds_id), and instance. It includes options for filtering, pagination (size, offset), and selecting fields. The snippet initializes the API client, sets parameters, calls the API, and includes exception handling. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) device_id = 56 # int | hds_id = 56 # int | instance_id = 56 # int | fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get detailed config information for the instance api_response = api_instance.get_device_config_source_config_list(device_id, hds_id, instance_id, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_device_config_source_config_list: %s\n" % e) ``` -------------------------------- ### Getting Top Talkers Graph with LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example illustrates how to configure API key authorization for the LogicMonitor Python SDK, initialize the API client, and fetch a top talkers graph. It shows how to pass required (id) and optional parameters (start, end, filter, format, keyword) and includes error handling for API calls. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) id = 56 # int | start = 789 # int | (optional) end = 789 # int | (optional) netflow_filter = 'netflow_filter_example' # str | (optional) format = 'format_example' # str | (optional) keyword = 'keyword_example' # str | (optional) try: # get top talkers graph api_response = api_instance.get_top_talkers_graph(id, start=start, end=end, netflow_filter=netflow_filter, format=format, keyword=keyword) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_top_talkers_graph: %s\n" % e) ``` -------------------------------- ### Configure API Client for LogicMonitor SDK in Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This snippet demonstrates the initial setup required to interact with the LogicMonitor API using the Python SDK. It imports necessary modules, configures API key authorization, and creates an instance of the `LMApi` class with the configured client. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Get Immediate Device List by Group ID - Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This snippet starts demonstrating how to call the `get_immediate_device_list_by_device_group_id` API method using the LogicMonitor Python SDK. It shows API key configuration but the code block is incomplete. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Adding Device LogicMonitor Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md Shows how to add a new device using the `add_device` method in the LogicMonitor Python SDK. It illustrates the setup for API key authorization and the beginning of the API instance creation. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) ``` -------------------------------- ### Getting Alert Rule by ID LogicMonitor Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md Fetches a single alert rule by its unique identifier using the LogicMonitor Python SDK. It allows specifying which fields to include in the response. Includes API key authorization setup and exception handling. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) id = 56 # int | fields = 'fields_example' # str | (optional) try: # get alert rule by id api_response = api_instance.get_alert_rule_by_id(id, fields=fields) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_alert_rule_by_id: %s\n" % e) ``` -------------------------------- ### Listing Config Sources - LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This snippet shows how to retrieve a paginated list of configuration sources using the LogicMonitor Python SDK. It covers API client initialization with authentication and exception handling. The example demonstrates the use of optional parameters like `format`, `fields`, `size`, `offset`, and `filter` for filtering and pagination. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) format = 'json' # str | (optional) (default to json) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get config source list api_response = api_instance.get_config_source_list(format=format, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_config_source_list: %s\n" % e) ``` -------------------------------- ### Get Alert by ID using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to retrieve a specific alert by its ID using the `get_alert_by_id` method of the LogicMonitor Python SDK. It includes setting up API key authorization and handling potential API exceptions. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) id = 'id_example' # str | need_message = false # bool | (optional) (default to false) custom_columns = 'custom_columns_example' # str | (optional) fields = 'fields_example' # str | (optional) try: # get alert api_response = api_instance.get_alert_by_id(id, need_message=need_message, custom_columns=custom_columns, fields=fields) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_alert_by_id: %s\n" % e) ``` -------------------------------- ### Get Admin List using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example demonstrates how to retrieve a list of users (admins) using the `get_admin_list` method of the LogicMonitor Python SDK. It shows how to configure API key authorization and handle potential API exceptions. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) type = 'type_example' # str | (optional) permission = 'permission_example' # str | (optional) filter_group_string = 'filter_group_string_example' # str | (optional) fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get user list api_response = api_instance.get_admin_list(type=type, permission=permission, filter_group_string=filter_group_string, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_admin_list: %s\n" % e) ``` -------------------------------- ### Adding Website using LogicMonitor Python SDK Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This code demonstrates how to add a new website resource using the LogicMonitor Python SDK. It initializes the API client, creates a Website object, and calls the add_website method. It includes error handling for API exceptions. ```python # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) body = logicmonitor_sdk.Website() # Website | try: # add website api_response = api_instance.add_website(body) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->add_website: %s\n" % e) ``` -------------------------------- ### Example: get_device_group_sdt_list (Python) Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md Provides a Python example for retrieving SDTs (Scheduled Down Times) for a specific device group using the LogicMonitor SDK. It illustrates the necessary steps for setting up API key authentication and invoking the `get_device_group_sdt_list` function with parameters such as group ID, fields, size, offset, and filter. Basic exception handling is included. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) id = 56 # int | fields = 'fields_example' # str | (optional) size = 50 # int | (optional) (default to 50) offset = 0 # int | (optional) (default to 0) filter = 'filter_example' # str | (optional) try: # get device group SDTs api_response = api_instance.get_device_group_sdt_list(id, fields=fields, size=size, offset=offset, filter=filter) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_device_group_sdt_list: %s\n" % e) ``` -------------------------------- ### Setting up for Getting a Report Group by ID in Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This partial snippet demonstrates the initial setup required to retrieve a report group by ID using the LogicMonitor Python SDK. It shows how to configure API key authorization and initialize the API client instance. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' ``` -------------------------------- ### Initialize LogicMonitor SDK for Collector Version List - Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This snippet demonstrates the initial setup required to retrieve a list of available LogicMonitor collector versions using the Python SDK. It includes necessary imports, configures API key authentication, and initializes the API client, preparing for the API call. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' ``` -------------------------------- ### Retrieving Device Instance Alert Setting with Python Source: https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md This example shows how to fetch the alert settings for a specific datasource instance on a device using the LogicMonitor Python SDK. It covers setting up API key authentication, initializing the API client, and invoking the get_device_datasource_instance_alert_setting_by_id method with the necessary device, datasource, instance, and setting IDs. It includes basic exception handling. ```python from __future__ import print_function import time import logicmonitor_sdk from logicmonitor_sdk.rest import ApiException from pprint import pprint # Configure API key authorization: LMv1 configuration = logicmonitor_sdk.Configuration() configuration.api_key['Authorization'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['Authorization'] = 'Bearer' # create an instance of the API class test api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration)) device_id = 56 # int | hds_id = 56 # int | Device-DataSource ID instance_id = 56 # int | id = 56 # int | fields = 'fields_example' # str | (optional) try: # get device instance alert setting api_response = api_instance.get_device_datasource_instance_alert_setting_by_id(device_id, hds_id, instance_id, id, fields=fields) pprint(api_response) except ApiException as e: print("Exception when calling LMApi->get_device_datasource_instance_alert_setting_by_id: %s\n" % e) ```