"Automatic Apply rules" delay

Started by Borgso, June 03, 2015, 11:58:16 AM

Previous topic - Next topic

Borgso

I'm using "Automatic Apply Rules" to apply templates to nodes depending on what value some DCIs have.
When i restart netxms, Apply rule rutines starts before DCI have any last values, making it goes bananas removing and adding templates randomly untill next scheduled "Apply Rule" runs and DCIs are having data.

I tried adding this to "Automatic Apply Rules", but abort doesnt work here:

$node2 = FindObject("netxms-server.tld", $node);
if($node2 != null) {
  $uptimeCheck = GetDCIValue($node2, FindDCIByDescription($node2, "System uptime (min)"));
  if ($uptimeCheck != null && $uptimeCheck < 360) {
    // Abort if netxms server just restarted
    abort;
  }
}


Are there any other way to delay Apply Rule routines?

tomaskir

The auto apply rules are called for a node each time a configuration poll happens on that node.
You can simply "return true;" and "return false;" in the first config poll run, the next run will then pick it up correctly.

I would advise against binding based on a DCI result, it will produce random results (like you are describing and more).
Instead create a snmp transport from the actual auto-apply script, and get actual value from there, and do your decisions based on that.

Borgso

Using SNMP is not a solution, most DCI are custom made push/exec pull because of in-house business specific units.

I do not see any problem days after netxms have been (re)started and DCI polling have run atleast once..

What im looking for is delay on the configuration polling, prevent it from running right after start.


Victor Kirhenshtein

That actually make sense to interpret runtime error / abort in auto apply script as no action - otherwise small typo can cause mass remove of templates. I've made change in server logic - now only explicitly returned false will cause unbind - runtime errors will be interpreted as "no change". It will be included in 2.0-M5 release.

Best regards,
Victor