cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VM Host Cleanup

Hi,

We are having agentless Vmware Inavtory based on API which pulls data from vCenters, apparently, there are number VM hosts we have seen which inventoried log back still those are present in All inventory. I have the below queries on that.

  1. Will automatically purged from All inventory?
  2. If yes, then what is the time frame after it gets purged.
  3. If not, then do we have any mechanism to remove/delete it or need to delete it manually.

My thought is if we removing any Vcenter from the Inventory rule then related all hosts must have removed themselves automatically.

Your thoughts pls. 

(1) Solution

Hi,

Please change the 90 days as needed. And please be aware what you're doing.

USE FNMSInventory

SELECT ir.ComputerID
INTO #Computer
FROM InventoryReport ir
WHERE DATEDIFF(DAY, COALESCE(SWDate,HWDate,VMWareServicesDate), GETDATE()) > 90

EXEC ComputerRemoveBatch

Best regards,

Markward 

View solution in original post

(3) Replies
mfranz
By Level 17 Champion
Level 17 Champion

Hi,

  1. As far as I know, there is no automatic process taking care of this.
  2. See 1.
  3. We usually do run a Business Import with some custom SQL to remove anything older than 90 days or something from the innventory database. ComputerRemoveBatch would be the Stored Procedure to look at, and tables Computer and InventoryReport.

Well, the resulting inventory is not linked to your inventory rule. So, removing the vCenter shouldn't change anything.

Best regards,

Ma rkward

@mfranz, Will you please help me with the SQL queries or any procedure document for deleting those old records.

Hi,

Please change the 90 days as needed. And please be aware what you're doing.

USE FNMSInventory

SELECT ir.ComputerID
INTO #Computer
FROM InventoryReport ir
WHERE DATEDIFF(DAY, COALESCE(SWDate,HWDate,VMWareServicesDate), GETDATE()) > 90

EXEC ComputerRemoveBatch

Best regards,

Markward