NetXMS Support Forum

English Support => General Support => Topic started by: Hanfelt on April 06, 2017, 10:22:33 AM

Title: Trying to make a more generic hp template - need to manipulate {instance} data?
Post by: Hanfelt on April 06, 2017, 10:22:33 AM
As im trying to make this template work on more hp servers i do get a little more info returned in {instance} then i would like, example it will return 4.1, 4.2 or 2.1, 2.2 and so on. I dont want the Data Collection Description to show (Array disk 2.1 status) just the last character 1 and 2 and so on. Is there anyway we can modify this with script or something?
Title: Re: Trying to make a more generic hp template - need to manipulate {instance} data?
Post by: Victor Kirhenshtein on April 09, 2017, 12:33:04 PM
Hi,

you can use instance filter script to modify instance itself or just instance name. For example, if you instance is two numbers connected with dot you can use the following filter script:


instance = $1;
if ($1 ~= "[0-9]+\\.([0-9]+)")
{
   return %(true, instance, $1);
}
return true;


This script will keep instance as is (i.e. 4.2) but set instance name to second number (i.e. 2). You can then use {instance-name} in description to insert updated display name.

Best regards,
Victor
Title: Re: Trying to make a more generic hp template - need to manipulate {instance} data?
Post by: Hanfelt on April 10, 2017, 12:24:22 PM
Thanks Victor ;) for helping me out.