Trying to make a more generic hp template - need to manipulate {instance} data?

Started by Hanfelt, April 06, 2017, 10:22:33 AM

Previous topic - Next topic

Hanfelt

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?

Victor Kirhenshtein

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