Hello everyone, do you know how can I call a script from a dci description?
for example, this is the description of a dci: TrafficIN %{script:getIfNameByName({instance-name})}
this is my script:
scriptName:getIfNameByName
sub getIfName(netString)
{
if (length(netString) > 0)
array a;
a [length(netString)];
a = SplitString(netString, " ");
return (a [
(a->size)-1
]
);
}
return getIfName($1);
how can I call that script and send "instance-name" as parameter?
It looks to me as if what you are trying to do should probably be done in the instance discovery filter script, rather than via attempting to call a script within the DCI description?
Yes your point is valid but I know that is possible, if I change the script and return any value, It appears on dci description.
I would like to know how to do it.
Sounds like {instance-name} is not being interpreted prior to calling the script.
Maybe add some trace commands to your script, e.g. something like this:
trace(0,"Instance Name: ".$1);
Then check your server logs and see what is being returned: Nothing? Literally "{instance-name}"? Something else?
Hi,
{instance-name} is a placeholder which is replaced only during instance discovery. You can set it's value by returning third element from instance filter script, like this:
return %(true, "this will became instance", "this will became instance name");
Best regards,
Victor