Hi All, I am trying to unmanage an application using orion API. I took python script to unmanage a node as a reference and modified it to also support for application.
Script was able to execute with no errors and exceptions but application didnt get unamanaged. I am kind of stuck here as don't have any errors to check and logs to find the root cause.
Please help if anyone has faced this issue before.
import requests
from orionsdk import SwisClient
from datetime import datetime, timedelta
def main():
hostname = 'localhost'
username = 'test'
password = 'dadasdd'
print("i am running")
swis = SwisClient(hostname, username, password)
results = swis.query('SELECT ApplicationID, ApplicationTemplateID FROM Orion.APM.Application WHERE ApplicationID = @ApplicationID', ApplicationID='28')
if results['results']:
ApplicationID = results['results'][0]['ApplicationID']
ApplicationTemplateID = results['results'][0]['ApplicationTemplateID']
netObjectId = 'AA:{}'.format(ApplicationID)
now = datetime.utcnow()
tomorrow = now + timedelta(days=1)
response = swis.invoke('Orion.APM.Application', 'Unmanage', netObjectId, now, tomorrow, False)
print('Done...{} will be Remanage until {}'.format(ApplicationID, tomorrow))
print('Response - {} '.format(response))
else:
print("Device doesn't Exist")
requests.packages.urllib3.disable_warnings()
if __name__ == '__main__':
main()
Thanks in advance for checking.
Regards
Devraj S