<?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[Custom Attributes as Parameters to DCIs]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am trying to achieve the following:</p>
<ul>
<li>Create a single template with a DCI</li>
<li>The DCI needs to be passed multiple parameters. These will differ per node.</li>
<li>Assign the template to a system based on the existence of a number of custom attributes on a node. That part is not a problem.</li>
<li>Use the values of these custom attributes as parameters for the DCI. That's the part that I can't get to work.</li>
</ul>
<p dir="auto">I've been searching and ran into this old post from 2013: <a href="https://www.netxms.org/forum/general-support/custom-attributes-2446/" rel="nofollow ugc">https://www.netxms.org/forum/general-support/custom-attributes-2446/</a><br />
But it doesn't really seem to help me. Not sure if I misunderstood the %{script:&lt;scriptname&gt;} part mentioned. Where would I put that in the above scenario, if that would even work in this case?</p>
<p dir="auto">Any other ways to achieve what I'm trying to do?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.netxms.org/topic/4391/custom-attributes-as-parameters-to-dcis</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:10:56 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4391.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Apr 2016 13:55:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Custom Attributes as Parameters to DCIs on Thu, 21 Apr 2016 13:40:03 GMT]]></title><description><![CDATA[<p dir="auto">Maybe using script DCIs will be better solution in your case. You can create script in a library which will be called by data collector, and that script will have access to all attributes of a node and can read appropriate data from agent or SNMP using AgentReadParameter or SNMPGetValue functions.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/19720</link><guid isPermaLink="true">https://forum.netxms.org/post/19720</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 21 Apr 2016 13:40:03 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Attributes as Parameters to DCIs on Tue, 19 Apr 2016 23:40:15 GMT]]></title><description><![CDATA[<p dir="auto">I got it to work somewhat. I kept overlooking the word "Template". It really only works if I apply the DCI to a template which is then applied to the node, at which time the macro is interpreted. So if I change the custom attribute, it won't auto-update the DCI - which is how it's documented.<br />
Auto-updating would be a nice feature. <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>
<p dir="auto">I then tried to create a script that returns a specific custom attribute and used that in a DCI: all good.<br />
Now I want to use this on a whole range of custom attributes - but don't want one script per attribute. Rather I want to pass the name of the attribute to fetch to the script. That way one script can return any custom attribute value, all I need to do is pass the name to the script macro.<br />
But that doesn't work.<br />
Not sure if scripts can't take parameters, if the macro doesn't handle passing them to the script or I'm missing something (again)?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.netxms.org/post/19691</link><guid isPermaLink="true">https://forum.netxms.org/post/19691</guid><dc:creator><![CDATA[Tursiops]]></dc:creator><pubDate>Tue, 19 Apr 2016 23:40:15 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Attributes as Parameters to DCIs on Thu, 07 Apr 2016 13:24:06 GMT]]></title><description><![CDATA[<p dir="auto">That doesn't seem to work for me.</p>
<p dir="auto">I have done the following:</p>
<ul>
<li>Configured a (Linux) node with a custom attribute called "testParameter", value is "Hello World".</li>
<li>Created a script called "GetAttribute", which returns the value for that attribute:</li>
</ul>
<pre><code>sub main()
{
	return GetCustomAttribute($node, "testParameter");
}
</code></pre>
<ul>
<li>Running the same code via Execute Server Script against the node returns "Hello World".</li>
<li>Configured an ExternalParameter on the node as follows:</li>
</ul>
<pre><code>ExternalParameter = HelloWorld(*):echo $1
</code></pre>
<ul>
<li>Created a DCI called "TESTING", with following Parameter: <code>HelloWorld(%{script:GetAttribute})</code> (I tried it like that, with single and double quotes).</li>
</ul>
<p dir="auto">I expected to see the DCI return "Hello World", but instead I see "%{script:GetAttribute}", i.e. the Macro is not being interpreted at all? Guess I'm still missing something?   <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f615.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--confused" style="height:1.4em;width:auto;vertical-align:middle" title=":-\" alt="😕" /></p>
]]></description><link>https://forum.netxms.org/post/19582</link><guid isPermaLink="true">https://forum.netxms.org/post/19582</guid><dc:creator><![CDATA[Tursiops]]></dc:creator><pubDate>Thu, 07 Apr 2016 13:24:06 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Attributes as Parameters to DCIs on Tue, 05 Apr 2016 14:18:58 GMT]]></title><description><![CDATA[<p dir="auto">The way is described here on the wiki as well:<br />
<a href="https://wiki.netxms.org/wiki/UM:Data_Collection#Macros_in_template_items" rel="nofollow ugc">https://wiki.netxms.org/wiki/UM:Data_Collection#Macros_in_template_items</a></p>
<p dir="auto">You can not currently access node's Custom Attributes directly from the DCIs, but with an intermediary script you can do it.</p>
<p dir="auto">So in your DCI, you would define it like this:</p>
<pre><code>MyDCI.Name("string_abbrib", %{script:get_node_attrib})
</code></pre>
<p dir="auto">Then create the script "get_node_attrib" in the Script Library that will return the Custom Attribute you desire.</p>
]]></description><link>https://forum.netxms.org/post/19567</link><guid isPermaLink="true">https://forum.netxms.org/post/19567</guid><dc:creator><![CDATA[tomaskir]]></dc:creator><pubDate>Tue, 05 Apr 2016 14:18:58 GMT</pubDate></item></channel></rss>