Add Device using the python SDK
Hello,
I have a challenge when I add a device using the logicmonitor Python SDK, I see the property values have been successfully added when I manage the device on LM, but the scripts that need the properties to run do not seem to work. I created a test script to just 'println' the properties and it gave me the correct values. The only way I could get around the problem was to manually re-enter the values that were populated by the script.
I have attached the script used below. Is there a consideration that has to be taken when setting the property of API keys? I am using text.
###############
async def addDevice(group_id):
body = logicmonitor_sdk.models.Device(
display_name=customer + '_Genesys_Host',
name=customer+'_Genesys_Host.lm.ipiplatform.com',
preferred_collector_id=38,
disable_alerting=False,
host_group_ids=group_id,
custom_properties=[
{'name': 'genesys.api.key', 'value': apiUser},
{'name': 'genesys.api.password', 'value': apiPass},
{'name': 'billing.api.key', 'value': billUser},
{'name': 'billing.api.password', 'value': billPass},
{'name': 'genesys.api.url', 'value': apiURL},
{'name': 'genesys.login.url', 'value': loginURL},
{'name': 'org.id', 'value': orgId},
{'name': 'system.categories', 'value': 'billing'}],
description='Genesys',
user_permission='write',
preferred_collector_group_name='C-IPI Customers (Auto Balanced Group - Linux)'
)
try:
api_response = api_instance.add_device(body, add_from_wizard=True)
pprint(api_response)
except ApiException as e:
logging.error(f"Exception when calling DevicesApi->addDevice: {e}")
####################################################################