Forum Discussion

systemgeek's avatar
2 years ago

Listing monitored websites via SDK

I am trying to use the SDK to print all of our websites so I can get a list of the URLs monitored.  It looks like getWebsiteList is the correct function to use.  And the example script seems to do exactly what I want.

from __future__ import print_function
import time
import logicmonitor_sdk
from logicmonitor_sdk.rest import ApiException
from pprint import pprint
import json

# Configure API key authorization: LMv1
configuration = logicmonitor_sdk.Configuration()
configuration.company = ''
configuration.access_id = ''
configuration.access_key = ''

# create an instance of the API class
api_instance = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration))

collectorIds = '' # String |  (optional)
fields = '' # String |  (optional)
size = 0 # Integer |  (optional)
offset = 0 # Integer |  (optional)
filter = '' # String |  (optional)

try:
    # get website list
    api_response = api_instance.get_website_list()
    pprint(api_response)

except ApiException as e:
    print("Exception when calling LMApi->getWebsiteList: %s\n" % e)

When I try this script the output tells me that we have 132 websites.  However, when I grep the output for domain I only see 33.  Can anyone tell me why this script is not returning all 132 websites???

12 Replies