This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Automating a Node to Unmanaged

I was looking at possible way to take a network device that has been offline for 45 days and have it change to Unmanaged. We have equipment that gets turned off, but not picked up from the site, so the network team does not want it removed from SW until it has been retrieved and checked back in.

Any Ideas?

Thanks,

  • Would probably have to write some custom scripts for this. I'm most comfortable in python and think you could set up a schedule to run the below once a day with some modifications


    orionsdk-python/unmanage_node.py at master · solarwinds/orionsdk-python · GitHub

    EDIT:
    Might want to check this but here is a SWQL query that you could use to replace the example in the script above

    #Only want the NodeID, Caption for the script just added the other stuff to help make it more obvious to what it is doing.
    SELECT TOP 1000 NodeID, Caption, Status, StatusIcon, LastSystemUpTimePollUtc, GETUTCDATE() - 45 as checkWhere

    FROM Orion.Nodes

    where lastSystemUpTimePollUTC <= GETUTCDATE() - 45 and status = 2

    order by lastSystemUpTimePollUTC desc

    so instead of
    results = swis.query('SELECT NodeID, Caption FROM Orion.Nodes WHERE IPAddress = @ip_addr', ip_addr='127.0.0.1')

    you could put

    results = swis.query('SELECT NodeID, Caption FROM Orion.Nodes where lastSystemUpTimePollUTC <= GETUTCDATE() - 45 and status = 2 order by lastSystemUpTimePollUTC desc)

    This change could return more than one Node so you would need to create a way to loop through the results instead of just if results['results']

    you would want

    if results['results']:

         #loop through results and the swis.invoke here