<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[dependency script based on infrastructure]]></title><description><![CDATA[<p dir="auto">Hi Victor,<br />
I was wondering if someone can maybe help me with the script issue I am having.</p>
<p dir="auto">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:</p>
<pre><code>return ($node-&gt;runtimeFlags &amp; 0x0004) ? 1 : 0;
</code></pre>
<p dir="auto">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.</p>
<blockquote>
<p dir="auto"><a href="https://www.netxms.org/forum/configuration/dependency-script-based-on-infrastructure/" rel="nofollow ugc">https://www.netxms.org/forum/configuration/dependency-script-based-on-infrastructure/</a></p>
</blockquote>
<p dir="auto">Code used:</p>
<pre><code>nparents = GetNodeParents($node);		// get parent objects of tested node
foreach(i : nparents)
{
	if (i-&gt;type == 5)			// if it is infrastructure object (container)...
	{
		oparents = GetObjectParents(i);	//... get parents of the object too...
		foreach(j : oparents)
		{
			if (j-&gt;type == 5)	//... and if it is infrastructure object (container) again...
			{
				children = GetObjectChildren(j);	//... get object children...
				foreach(k : children)
				{
					if ((k-&gt;status == 4) &amp;&amp;	(classof(k)!=&quot;NetObj&quot;)) return 0;	//... and if the status of any of the children objects is &quot;critical&quot; (bypassing non-node objects) do not take action.
				}
			}
		}
	}
}
return 1;	// else allow action
</code></pre>
<p dir="auto">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.<br />
I have them this way as it makes it easier to view on Status Map.</p>
<p dir="auto">Any assistance would be greatly appreciated. <img
      src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc"
      class="not-responsive emoji emoji-android emoji--slightly_smiling_face"
      style="height: 1.4em; width: auto; vertical-align: middle;"
      title=":)"
      alt="🙂"
    /></p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000004470-Capture.JPG" alt="Capture.JPG" class="img-markdown  img-fluid" width="226" height="96" /></p>
]]></description><link>https://forum.netxms.org/topic/5927/dependency-script-based-on-infrastructure</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 11:41:36 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/5927.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Apr 2019 14:00:46 GMT</pubDate><ttl>60</ttl></channel></rss>