<?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[Create System.Shutdown action for entire container]]></title><description><![CDATA[<p dir="auto">I know how to use create an action using "Execute command on remote node via agent" to execute System.Shutdown on an individual node.  Is it possible to create an action that will execute System.Shutdown on every node within a container?  The use-case is that I want to use an event processing policy rule to trigger System.Shutdown for a group of nodes when a certain DCI (UPS remaining runtime) hits a threshold.</p>
]]></description><link>https://forum.netxms.org/topic/5593/create-system.shutdown-action-for-entire-container</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 09:45:23 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/5593.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 29 May 2018 19:42:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Create System.Shutdown action for entire container on Thu, 31 May 2018 05:28:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">just one addition - check for "NetObj" class here:</p>
<p dir="auto">else if (classof(o) == "NetObj")</p>
<p dir="auto">is unnecessary - GetObjectChildren will only return objects of class NetObj and derivatives. Even more, that way you may miss some nodes on next levels, for example if you have cluster object - then it's class will be "Cluster", not a "NetObj". Simple "else" is enough here.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/24358</link><guid isPermaLink="true">https://forum.netxms.org/post/24358</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 31 May 2018 05:28:01 GMT</pubDate></item><item><title><![CDATA[Reply to Create System.Shutdown action for entire container on Wed, 30 May 2018 00:27:55 GMT]]></title><description><![CDATA[<p dir="auto">Excellent solution, Gary.  Your assumption about one policy per container is correct.  I did a bit of testing and it appears that this will fit the bill perfectly.  Putting the nodes into maintenance mode before shutdown is a nice touch, too.</p>
<p dir="auto">Many thanks!<br />
Shane</p>
]]></description><link>https://forum.netxms.org/post/24353</link><guid isPermaLink="true">https://forum.netxms.org/post/24353</guid><dc:creator><![CDATA[srh]]></dc:creator><pubDate>Wed, 30 May 2018 00:27:55 GMT</pubDate></item><item><title><![CDATA[Reply to Create System.Shutdown action for entire container on Tue, 29 May 2018 21:52:01 GMT]]></title><description><![CDATA[<p dir="auto">There are probably a few different ways to do this but this will get you started and you can expand from there.</p>
<ol>
<li>Create the following script in the Script Library (Configuration/Script Library). Here I am assuming that you will have an event policy for each container and will create a script for each container. You could probably pass in the node, get the parent of the node, and use that as your start point so you could have just one script/event.</li>
</ol>
<pre><code>// Find Container by ID that needs shutdown and start enumeration from it. Replace nnnn with the ID of the container
EnumerateNodes(FindObject(nnnn));

// This function walks object tree recursively starting from given root
sub EnumerateNodes(rootObject)
{
	// Walk all child objects
	foreach(o : GetObjectChildren(rootObject))
	{
		if (classof(o) == "Node")
		{
			// Process node object
			trace(1, "  + " . o-&gt;name);
			if (o-&gt;isAgent == 1)
			//Put the node into maintenance node
			EnterMaintenance(o);
			//Uncomment the next line to shutdown the systems
			//AgentExecuteAction(o, "System.Shutdown");
			//Use the below line to debug and make sure you are working with the intended nodes. You could also just use the Maintenance mode as an indication.
			SetCustomAttribute(o, "TestShutdown", "Success");

		}
		else if (classof(o) == "NetObj")
		{
			// For all other objects, go down the tree
			// There can be additional checks for object class, like
			// if (o-&gt;type == 5)
			EnumerateNodes(o);
		}
	}
}
</code></pre>
<ol start="2">
<li>
<p dir="auto">Create an Actions Configuration (Configuration/Actions Configuration). Type will be Exectue NXSL script</p>
</li>
<li>
<p dir="auto">Use the action in your Event Policy</p>
</li>
</ol>
<p dir="auto">I did basic testing, but nothing extensive. This is intended to get you started (although it may work for you as is).<br />
If you want to test the script, you can use  Tools/Server Console and "exec &lt;scriptname&gt;".</p>
<p dir="auto">If you have any questions or need further assistance, let me know.</p>
<p dir="auto">Gary</p>
]]></description><link>https://forum.netxms.org/post/24352</link><guid isPermaLink="true">https://forum.netxms.org/post/24352</guid><dc:creator><![CDATA[gdodd]]></dc:creator><pubDate>Tue, 29 May 2018 21:52:01 GMT</pubDate></item></channel></rss>