AnsweredAssumed Answered

New host identification through Tagging and Groovy Script

Question asked by Paul Field on May 30, 2014
Latest reply on Jun 9, 2014 by Parag Baxi

I am trying to identify new hosts found from our daily discovery scan and tag them to be reviewed (sort of like unknown host identification).  I have a groovy script which i think should work but new hosts identified in the discovery scan on one day, are still in the tag when found the second day.


For Example

Tag A - Daily Discovery scan for o/s and hostname via IP range

Tag B - Contains groovy script which should add new host (Host C) found from scan of Tag A


The idea is that if Host C is scanned the following day, it gets removed from Tag B.


Below is the failing syntax I have for the example above.


if(asset.getAssetType()!=Asset.AssetType.HOST) return false;

  days_old = 1

  def today = new Date();

if (today.minus(asset.getCreated().toDate()) >= days_old) return false;

  return asset.lastVmScanDate.minus(1) < asset.created;


Any help is appreciated


Thank you