NetXMS Support Forum

English Support => General Support => Topic started by: lindeamon on May 16, 2011, 01:50:55 PM

Title: Filter Script
Post by: lindeamon on May 16, 2011, 01:50:55 PM
hi,

i am trying to create a network discovery filter script which will include several "AddrInSubnet" of several different subnets.
i have managed to create a script with the return function but after reading the use manual i have come to realize that this is not the solution.
can anyone help ?

10x,
Lindeamon
Title: Re: Filter Script
Post by: Victor Kirhenshtein on May 17, 2011, 11:50:56 AM
Can you post your script?

Best regards,
Victor
Title: Re: Filter Script
Post by: lindeamon on May 17, 2011, 01:31:41 PM
sub main()
{
  return AddrInSubnet($1->ipAddr,"xxx.xxx.xxx.xxx","255.255.255.0) ||
  return AddrInSubnet($1->ipAddr,"xxx.xxx.xxx.xxx","255.255.255.0);
}
Title: Re: Filter Script
Post by: lindeamon on May 17, 2011, 01:35:26 PM
hi victor,

when i am trying to select a network discovery filter script the "select" button does not work, why is that ?
i have created a script with the name Filter::xxx ,is that the name i should enter in the script name param. or should i enter just xxx ?

10x alot,
lindeamon
Title: Re: Filter Script
Post by: Victor Kirhenshtein on May 17, 2011, 03:32:25 PM
Hi!

Correct script will be

sub main()
{
  return AddrInSubnet($1->ipAddr,"xxx.xxx.xxx.xxx","255.255.255.0") ||
     AddrInSubnet($1->ipAddr,"xxx.xxx.xxx.xxx","255.255.255.0");
}

or simply

return AddrInSubnet($1->ipAddr,"xxx.xxx.xxx.xxx","255.255.255.0") ||
    AddrInSubnet($1->ipAddr,"xxx.xxx.xxx.xxx","255.255.255.0");

You have to enter full name of the script, like Filter::xxx.

Best regards,
Victor
Title: Re: Filter Script
Post by: lindeamon on May 18, 2011, 07:48:31 AM
hi victor,

thanx a lot for your help.
one last question though, is there a way to do this in a loop where the subnet ip addresses will be declared at the beginning and  the script will check all of them until a match found ?

something like that:

a="xxx.xxx.xxx.xxx"
b="yyy.yyy.yyy.yyy"

do...until
return AddrInSubnet($1->ipAddr,a,"255.255.255.0");

thank u