Using data from the device General tab for template auto-apply

Started by DesertRat, March 10, 2021, 12:06:39 AM

Previous topic - Next topic

DesertRat

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.

DesertRat

Got it! I just need to reference $node->productName in the Rule.

DesertRat

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)";


DesertRat

I tried this too and still no joy.

return ($node.productName ~= "ePMP3000 (FCC)") ? true : false;

Millenium7

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

Millenium7

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;



Victor Kirhenshtein

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