Unsolved

This post is more than 5 years old

137763

September 26th, 2012 15:00

Need help creating custom rule for VMW VirtualMachineLogicalDisk

I'm trying to create a custom rule for an application to receive alerts when their virtual drives are getting full.  I don't want them to receive other alerts that the system generates, just one's for their specific VM's.  I tried opening a support ticket but still need assistance.  Has anyone out here done this?

Thanks,

Vince

September 26th, 2012 16:00

So did he add that code to the conditions of the rule?  I know practically nothing about groovy and syntax.  So if the name has npwgp in it, that will be true?  No idea what the BigDecimal is or if it's needed, the bottom part is what is in my copied rule. 

try{

BigDecimal bd = new  BigDecimal(#capacityAvailable from $scope.hostLogicalDisk#.toString());

availbility = bd.setScale(2,BigDecimal.ROUND_HALF_UP);

if(scope.get("virtualMachine").get("name").substring(0,8)!='npwgp')

{

if(availbility<=registry("VMWGaz vmLogicalDrive.fatal")) return true;

else return false;

}

else return false;

} catch (Exception e) {return false;}

-------------------------------------------------------------------------------------------------------------

if(scope.get("localState") <= 4)

{

try{

qObjs = #totalSpace from $scope.hostLogicalDisk#;

tmpList = qObjs?.values(qObjs?.topologyObjects[0]);

if(tmpList==null || tmpList?.size() == 0) {

          return false;

}

timeToFill = VMwareGetTimeToFull(#spaceUsed from $scope.hostLogicalDisk  for 7 days 1 day ago#,tmpList.get(0)?.getValue()?.getAvg());

if(timeToFill==null) return false;

@rulette_data["TimeToFill"] = timeToFill;

if((timeToFill!=0) && (timeToFill < registry("VMW:noOfDays.fatal"))) return true;

else return false;

}

catch (Exception e) {return false;}

}

return false;

No Events found!

Top