NetXMS Support Forum

English Support => General Support => Topic started by: adimitrov on November 13, 2017, 11:56:33 AM

Title: Issue with auto apply/remove template
Post by: adimitrov on November 13, 2017, 11:56:33 AM
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).
Title: Re: Issue with auto apply/remove template
Post by: Tatjana Dubrovica on November 14, 2017, 05:57:32 PM
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;
}
Title: Re: Issue with auto apply/remove template
Post by: adimitrov on November 27, 2017, 03:22:49 PM
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