<?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[Template DCI & Instance name in transformation script]]></title><description><![CDATA[<p dir="auto">Is there a way to insert the {instance-name} into a transformation script?  I have a Dummy DCI, "Total traffic on {instance-name} (bits/sec)" that sums 2 other DCIs and returns sum.  I'd like to apply this DCI via templates.</p>
<p dir="auto">Template DCI transformation script:</p>
<pre><code>In = GetDCIValue($node, FindDCIByDescription($node, "Inbound traffic on " . {instance-name} . " (bits/sec)"));
Out = GetDCIValue($node, FindDCIByDescription($node, "Outbound traffic on " . {instance-name} . " (bits/sec)"));
if ( In == null &amp;&amp; Out == null )
	return 0;
if ( In == null &amp;&amp; Out != null )
	return Out;
if ( In != null &amp;&amp; Out == null )
	return In;
return In + Out;
</code></pre>
<p dir="auto">Template DCI Instance Discovery:<br />
SNMP Walk - OIDs<br />
Base SNMP OID:  .1.3.6.1.2.1.31.1.1.1.1<br />
Filter script:<code>return %(true, $1, $2);</code></p>
<p dir="auto">I've tried replacing {instance-name} with $2 but no luck.  Any help is appreciated.</p>
]]></description><link>https://forum.netxms.org/topic/4888/template-dci-instance-name-in-transformation-script</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 09:40:11 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4888.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Jan 2017 16:12:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Template DCI & Instance name in transformation script on Thu, 26 Jan 2017 17:23:32 GMT]]></title><description><![CDATA[<p dir="auto">$dci is global variable containing reference to current DCI object. You can find class description here: <a href="https://wiki.netxms.org/wiki/NXSL:DCI" rel="nofollow ugc">https://wiki.netxms.org/wiki/NXSL:DCI</a>. Instance is it's attribute.</p>
<p dir="auto">Transformation scripts in templates never executed - it is just a template for real DCIs.</p>
<p dir="auto">It is not possible to disable DCI from script.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/21755</link><guid isPermaLink="true">https://forum.netxms.org/post/21755</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 26 Jan 2017 17:23:32 GMT</pubDate></item><item><title><![CDATA[Reply to Template DCI & Instance name in transformation script on Wed, 25 Jan 2017 21:20:31 GMT]]></title><description><![CDATA[<p dir="auto">This is slightly off topic, so I can create new post if you like.  Is there a way to change the DCI status to Disabled during Instance Discovery?  I've tried the following in a Template DCI instance discovery, but it doesn't work:</p>
<pre><code>snmp = CreateSNMPTransport($node);
if (snmp == null)
	$dci-&gt;status = 1;
oid = ".1.3.6.1.2.1.2.2.1.8." . $1;
ifOper = SNMPGetValue(snmp, oid);
if ( ifOper != 1 )
	$dci-&gt;status = 1; }
return %(true, $1, $2);
</code></pre>
<p dir="auto">This is supposed to check ifOper status and disable the DCI of the status is not UP.</p>
]]></description><link>https://forum.netxms.org/post/21751</link><guid isPermaLink="true">https://forum.netxms.org/post/21751</guid><dc:creator><![CDATA[zsing82]]></dc:creator><pubDate>Wed, 25 Jan 2017 21:20:31 GMT</pubDate></item><item><title><![CDATA[Reply to Template DCI & Instance name in transformation script on Wed, 25 Jan 2017 17:15:07 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Victor.  That seems to work.  The transformation script in the Node DCI is the same as in the Template DCI.  How does $dci-&gt;instance work exactly?  Is there documentation of this feature anywhere?</p>
<p dir="auto">Again, thanks for your help!!</p>
]]></description><link>https://forum.netxms.org/post/21750</link><guid isPermaLink="true">https://forum.netxms.org/post/21750</guid><dc:creator><![CDATA[zsing82]]></dc:creator><pubDate>Wed, 25 Jan 2017 17:15:07 GMT</pubDate></item><item><title><![CDATA[Reply to Template DCI & Instance name in transformation script on Tue, 24 Jan 2017 17:45:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">try to use $dci-&gt;instance like this:</p>
<pre><code>In = GetDCIValue($node, FindDCIByDescription($node, "Inbound traffic on " . $dci-&gt;instance . " (bits/sec)"));
[code]

Best regards,
Victor
</code></pre>
]]></description><link>https://forum.netxms.org/post/21730</link><guid isPermaLink="true">https://forum.netxms.org/post/21730</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 24 Jan 2017 17:45:58 GMT</pubDate></item><item><title><![CDATA[Reply to Template DCI & Instance name in transformation script on Tue, 24 Jan 2017 15:04:39 GMT]]></title><description><![CDATA[<p dir="auto">I'm doing something similar and use <code>$dci-&gt;description</code> to get name + instance of the dummy DCI.</p>
<p dir="auto">In your case, you need additional some string operations.</p>
]]></description><link>https://forum.netxms.org/post/21729</link><guid isPermaLink="true">https://forum.netxms.org/post/21729</guid><dc:creator><![CDATA[user55116]]></dc:creator><pubDate>Tue, 24 Jan 2017 15:04:39 GMT</pubDate></item></channel></rss>