NetXMS Support Forum

English Support => General Support => Topic started by: DesertRat on March 10, 2021, 12:06:39 AM

Title: Using data from the device General tab for template auto-apply
Post by: DesertRat on March 10, 2021, 12:06:39 AM
I can see the vendor and product name in the general tab of an added node. How can I use this information automatic apply rules for a template? I have scoured the MIBs can not seem to find it.
Title: Re: Using data from the device General tab for template auto-apply
Post by: DesertRat on March 10, 2021, 12:40:37 AM
Got it! I just need to reference $node->productName in the Rule.
Title: Re: Using data from the device General tab for template auto-apply
Post by: DesertRat on March 10, 2021, 01:12:14 AM
I have added this to the Auto Apply filter and it still doesn't apply the template to the nodes. What am I missing?

return $node.productName like "ePMP3000 (FCC)";

Title: Re: Using data from the device General tab for template auto-apply
Post by: DesertRat on March 10, 2021, 01:21:22 AM
I tried this too and still no joy.

return ($node.productName ~= "ePMP3000 (FCC)") ? true : false;
Title: Re: Using data from the device General tab for template auto-apply
Post by: Millenium7 on March 10, 2021, 03:02:51 AM
Just a guess but I think you need to return a 'true' or 'false' in order for it work
And it could be that your RegEx syntax is wrong?

Maybe try "ePMP3000 \(FCC\)" the backslashes mean a literal '(' or ')' otherwise () implies a capture group
You could also try "ePMP3000.*" if you don't care about it having to exactly have "(FCC)" on the end
Title: Re: Using data from the device General tab for template auto-apply
Post by: Millenium7 on March 10, 2021, 03:04:36 AM
Otherwise here's a sample of what I use for Cambium ePMP series (all of them, not just 3000 specifically)

// ePMP series
if ($node->snmpOID ~= "(.1.3.6.1.4.1.17713.21.9).*") return true;


Title: Re: Using data from the device General tab for template auto-apply
Post by: Victor Kirhenshtein on March 10, 2021, 08:26:36 PM
Your syntax is wrong - you should use -> operator for accessing object properties (dot is string concatenation). Also, brackets denote capture group in regular expression, you should escape them with backslashes.


return $node->productName ~= "ePMP3000 \\(FCC\\)";


should work.

Best regards,
Victor