Issue with auto apply/remove template

Started by adimitrov, November 13, 2017, 11:56:33 AM

Previous topic - Next topic

adimitrov

Hello team,

I have configured a simple script which work as a DCI in NetXMS. The script and the DCI works perfect, but the devices on which i need the script are a lot and i have configured auto apply on a template, which seemed to be working fine.

The auto apply script is really simple, it check if the device have a specific Custom Attribute and if it is router or switch:

if ((GetCustomAttribute($node, "RANCID_ENABLED") ~= "1") && ($node->isRouter ~= "1") || ($node->isBridge ~= "1"))
{ return true;
} else {
return false;
}

Yesterday for some reason auto apply set devices under the template which doesn't really apply to the filter. This resulted in false positive alarms. The strange thing is when i initiate configuration poll the DCI is not removed. If removed manually it does not apply again (just tried to reproduce the issue). Is there a problem with automatically removing DCI when they no longer passes though the filter?
Configuration poll with debug level 6 from problematic device attached (nothing happens).

Tatjana Dubrovica

We have not faced any issues with auto remove.
Please verify, that "Remove this template automatically when node no longer passes through filter" option is selected for the template on "Automatic Apply Rules" property page.

Also in your script:
Template will be applied to all routers with custom attribute or to bridges(with or without custom attributes). If you want to check custom attributes for bot is should look like:

if ((GetCustomAttribute($node, "RANCID_ENABLED") ~= "1") && (($node->isRouter ~= "1") || ($node->isBridge ~= "1")))
{ return true;
} else {
return false;
}

adimitrov

Hello Tatjana, team,

I can confirm that "Remove this template automatically when node no longer passes through filer" option is selected. Thanks for pointing my mistake out. I will check if this is the issue here and will update.

Best regards,
Adrian