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.

Manage resources list for multiple nodes in Orion

Some from "Volume utilization" resources like "/run/" and "/sys" must be removed recursively from production monitoring on more than three hundreds nodes which already added.

 Volume Utilization

  •  Swap space - KEEP IN MONITORING
  •  - KEEP IN MONITORING
  •  /sys/fs/cgroup - REMOVE FROM MONITORING
  •  /run - REMOVE FROM MONITORING
  •  /run/lock - REMOVE FROM MONITORING
  •  /run/shm - REMOVE FROM MONITORING
  •  /run/user - REMOVE FROM MONITORING

Is there any way to automate this process instead of try to remove this not required resources by hands for each node?

Thanks!

  • Three hundred nodes not that many. I would do this by going to Manage Nodes, expanding nodes one by one and selecting not needed volumes - then deleting them. You do not need to "List Resources" on every single node. This will be clean solution, but will required maybe 30-60 minutes of your focused energy to go through 300 nodes. Can be done by SQL script, but I try to avoid any scripted delete operations in case there are some dependencies that I am not aware of

  • Hello, yes... It's possible by using Orion SDK connected to Orion API via Information Service V3.

    Just install latest version of SDK on some machine, which can connect to Orion Server (pingable + opened ports 17777 and 17778).

    Here's snippet for PowerShell (you need to have allowed scripts execution on your system - if not, than run "Set-executionPolicy "bypass""). I recommend yo use some GUI for PowerShell (Powershell ISE, PowerGui, etc...)

    #Region PSSnapin presence check/add

    if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue))

    {   

        Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue

    }

    #EndRegion

    #Connect to SWIS

    $swis = Connect-Swis -host "localhost" -UserName admin -Password ""

    #Query Volumes and remove in bulk

    Get-SwisData $swis "SELECT uri from Orion.Volumes where caption like '/run%' or caption like '/sys%'" | Remove-SwisObject $swis

    I hope it helps.

    Honza

  • Deletion by SQL script would cause remaining of orphaned data in the database. I suggest to use supported way by using Orion API I described bellow... It will do everything for you...

  • Sounds good. What about if I need to make a changes only for nodes which names begins with "production", like production-node1 , production-node2, etc. ?

  • That's really cool. So, just this one line would take care of all dependencies, etc... I need to learn SDK ...

  • Than you will use the update syntax. Here's example for changing the PollInterval and rediscoverInterval, but you can change random property, belonging to the Nodes. You always would need Uri (unique object identified), connection to your Orion SWIS, properties and their values:

    Get-SwisData $swis "SELECT uri from Orion.Nodes where caption like '%production%'" | Set-SwisObject $swis -Properties @{PollInterval=123; RediscoverInterval=60}

  • I've checked your way - works 100%, long time "Resource List" opening really isn't required, just used "Delete" from "Node Management" sorted by node name  list. But still supposed to takes more time than "API script" solution, though second must be well tested before run in production emoticons_happy.png.

    Thanks!

  • it should work fine, however if you're affraid of disaster, you can reduce the scope of deletion by using the TOP clause... E.g.


    Get-SwisData $swis "SELECT TOP 1 uri from Orion.Volumes where caption like '/run%' or caption like '/sys%' order by VolumeID asc" | Remove-SwisObject $swis 


    than always the one volume with lowest VolumeID will be deleted (and record in DeletedVolumes table will be created)