dependency script based on infrastructure

Started by NicovdWalt, April 30, 2019, 05:00:46 PM

Previous topic - Next topic

NicovdWalt

Hi Victor,
I was wondering if someone can maybe help me with the script issue I am having.

I have the following script to only trigger and alarm email when the device is offline for longer that the specified time configured in the Thresholds:

return ($node->runtimeFlags & 0x0004) ? 1 : 0;

The problem I am having is that I get about 100+ emails when a site goes down for power failure or something. I was looking at another thread where there was a script used for filtering alarms.
Quotehttps://www.netxms.org/forum/configuration/dependency-script-based-on-infrastructure/
Code used:
nparents = GetNodeParents($node); // get parent objects of tested node
foreach(i : nparents)
{
if (i->type == 5) // if it is infrastructure object (container)...
{
oparents = GetObjectParents(i); //... get parents of the object too...
foreach(j : oparents)
{
if (j->type == 5) //... and if it is infrastructure object (container) again...
{
children = GetObjectChildren(j); //... get object children...
foreach(k : children)
{
if ((k->status == 4) && (classof(k)!="NetObj")) return 0; //... and if the status of any of the children objects is "critical" (bypassing non-node objects) do not take action.
}
}
}
}
}
return 1; // else allow action



I have been trying to make this work but have no luck, I think the problem is my layout in NetXMS structure for sites. Attached image is my structure.
I have them this way as it makes it easier to view on Status Map.

Any assistance would be greatly appreciated. :)