<?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[Transformation Script execution error - Error 17]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I'm experiencing this error after implementing <a href="https://wiki.netxms.org/index.php?title=MTBF_%28Mean_Time_Between_Failures%29_and_MTTR_%28Mean_Time_To_Repair%29_Calculation&amp;mobileaction=toggle_view_mobile" rel="nofollow ugc">MTBF (Mean Time Between Failures) and MTTR (Mean Time To Repair) Calculation</a></p>
<p dir="auto">This is related to the "Node availability (percentage)" DCI only (other DCIs are OK):<br />
See attached Capture1.PNG</p>
<p dir="auto">Here's the error msg:<br />
See attached Capture3.PNG</p>
<p dir="auto">Here's the line of code being referred to:<br />
See attached Capture2.PNG</p>
<p dir="auto">Here's the full script:</p>
<pre><code>// This script calculates MTTR, MTBF and perAvailability parameters and stores them in custom attributes
// Initialize some custom attributes the first time.
// Undefined attributes are created by SetCustomAttribute function automatically
CurrentStatus = GetDCIValue($node, FindDCIByName($node, "Status"));
PreviousState = GetCustomAttribute($node, "PreviousState");
if (PreviousState == null)
{ // In the first time, previous state is null
	SetCustomAttribute($node, "PreviousState", CurrentStatus);
	SetCustomAttribute($node, "TimeStamp", time());
	SetCustomAttribute($node, "NumFailures", 0);
	SetCustomAttribute($node, "TotalUptime", 0);
	SetCustomAttribute($node, "TotalDowntime", 0);
	return 100;
}

// From here the 2nd and subsequent times
NumFailures = GetCustomAttribute($node, "NumFailures");
LastTime = time() - GetCustomAttribute($node, "TimeStamp");

// Status is up
if (CurrentStatus == 0)
{
	if (PreviousState != CurrentStatus)
	{   // just changed to up
		// update mttr
		TotalDowntime = GetCustomAttribute($node, "TotalDowntime") + LastTime;
		mttr = TotalDowntime / ((NumFailures == 0) ? 1 : NumFailures) / 3600;   // to prevent division by ze
		SetCustomAttribute($node, "TotalDowntime", TotalDowntime);
		SetCustomAttribute($node, "mttr", mttr);
	}
	else
	{      // still up
		// update mtbf
		TotalUptime = GetCustomAttribute($node, "TotalUptime") + LastTime;
		mtbf = TotalUptime / ((NumFailures == 0) ? 1 : NumFailures) / 3600;   // to prevent division by zero
		SetCustomAttribute($node, "TotalUptime", TotalUptime);
		SetCustomAttribute($node, "mtbf", mtbf);
	}
}

// Status is down
if (CurrentStatus == 4)
{
	if (PreviousState != CurrentStatus)
	{   // just changed to down
		// update mtbf
		NumFailures++;
		TotalUptime = GetCustomAttribute($node, "TotalUptime") + LastTime;
		mtbf = TotalUptime / NumFailures / 3600;
		SetCustomAttribute($node, "NumFailures", NumFailures);
		SetCustomAttribute($node, "TotalUptime", TotalUptime);
		SetCustomAttribute($node, "mtbf", mtbf);
	}
	else
	{   // still down
		// update mttr
		TotalDowntime = GetCustomAttribute($node, "TotalDowntime") + LastTime;
		mttr = TotalDowntime / NumFailures / 3600;
		SetCustomAttribute($node, "TotalDowntime", TotalDowntime);
		SetCustomAttribute($node, "mttr", mttr);
	}
}

if (CurrentStatus == 0 || CurrentStatus == 4)
{
	// Save previous state and timestamp
	SetCustomAttribute($node, "PreviousState", CurrentStatus);
	SetCustomAttribute($node, "TimeStamp", time());

	// perAvailability section
	TotalUptime = GetCustomAttribute($node, "TotalUptime");
	TotalDowntime = GetCustomAttribute($node, "TotalDowntime");
	perAvailability = TotalUptime / (TotalUptime + TotalDowntime) * 100;
	SetCustomAttribute($node, "perAvailability", perAvailability);

	return perAvailability;
}
</code></pre>
<p dir="auto">Appreciate any help.<br />
Thanks</p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000003451-Capture1.PNG" alt="Capture1.PNG" class="img-markdown  img-fluid" width="694" height="142" /></p>
<p dir="auto"><img src="/assets/uploads/files/smf/0000000003453-Capture2.PNG" alt="Capture2.PNG" class="img-markdown  img-fluid" width="877" height="467" /></p>
<p dir="auto"><img src="/assets/uploads/files/smf/0000000003455-Capture3.PNG" alt="Capture3.PNG" class="img-markdown  img-fluid" width="990" height="145" /></p>
]]></description><link>https://forum.netxms.org/topic/4931/transformation-script-execution-error-error-17</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 10:49:54 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4931.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Feb 2017 22:38:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Transformation Script execution error - Error 17 on Fri, 24 Feb 2017 09:22:34 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">You can solve issue by:</p>
<ol>
<li>unbind template with SLA DCI from node</li>
<li>delete SLA custom attributes from node</li>
<li>on node create DCI described Status collecting Status parameter from origin Internal</li>
<li>apply template with SLA DCI to node</li>
</ol>
<p dir="auto">or:</p>
<ol>
<li>manually populate SLA custom attributes with values</li>
<li>on node create DCI described Status collecting Status parameter from origin Internal</li>
</ol>
<p dir="auto">Br, A</p>
]]></description><link>https://forum.netxms.org/post/21890</link><guid isPermaLink="true">https://forum.netxms.org/post/21890</guid><dc:creator><![CDATA[sodalist]]></dc:creator><pubDate>Fri, 24 Feb 2017 09:22:34 GMT</pubDate></item><item><title><![CDATA[Reply to Transformation Script execution error - Error 17 on Wed, 22 Feb 2017 00:35:05 GMT]]></title><description><![CDATA[<p dir="auto">Does a DCI called "Status" exist on the node?<br />
I know this used to be an internal DCI that was added for any node automatically, but it isn't in newer versions.</p>
<p dir="auto">You may have to create a script DCI providing the result of $node-&gt;status for what you are trying to achieve.<br />
See <a href="https://wiki.netxms.org/wiki/NXSL:NetObj" rel="nofollow ugc">https://wiki.netxms.org/wiki/NXSL:NetObj</a> for possible values.</p>
]]></description><link>https://forum.netxms.org/post/21870</link><guid isPermaLink="true">https://forum.netxms.org/post/21870</guid><dc:creator><![CDATA[Tursiops]]></dc:creator><pubDate>Wed, 22 Feb 2017 00:35:05 GMT</pubDate></item><item><title><![CDATA[Reply to Transformation Script execution error - Error 17 on Tue, 21 Feb 2017 18:36:09 GMT]]></title><description><![CDATA[<p dir="auto">I have added additional info to my original post as FYI.</p>
]]></description><link>https://forum.netxms.org/post/21869</link><guid isPermaLink="true">https://forum.netxms.org/post/21869</guid><dc:creator><![CDATA[krazi]]></dc:creator><pubDate>Tue, 21 Feb 2017 18:36:09 GMT</pubDate></item></channel></rss>