<?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[Get mac vendor result as dci]]></title><description><![CDATA[<p dir="auto">Hello</p>
<p dir="auto">What is the best way to get "<a href="https://api.macvendors.com/%25%7Bnode_mac%7D" rel="nofollow ugc">https://api.macvendors.com/%{node_mac}</a>" result as DCI value and apply that via template ?</p>
<p dir="auto">Egert</p>
]]></description><link>https://forum.netxms.org/topic/6868/get-mac-vendor-result-as-dci</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:40:34 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/6868.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Jan 2021 11:48:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Get mac vendor result as dci on Tue, 19 Jan 2021 07:51:53 GMT]]></title><description><![CDATA[<p dir="auto">Many thanks for greate examples, got it working and went with mapping table version. <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">Egert</p>
]]></description><link>https://forum.netxms.org/post/29308</link><guid isPermaLink="true">https://forum.netxms.org/post/29308</guid><dc:creator><![CDATA[Egert143]]></dc:creator><pubDate>Tue, 19 Jan 2021 07:51:53 GMT</pubDate></item><item><title><![CDATA[Reply to Get mac vendor result as dci on Mon, 18 Jan 2021 15:26:37 GMT]]></title><description><![CDATA[<p dir="auto">You can download latest mapping here: <a href="http://standards-oui.ieee.org/oui.txt" rel="nofollow ugc">http://standards-oui.ieee.org/oui.txt</a></p>
<p dir="auto">Then parse it and save in the mapping table (in this example - using nxshell):</p>
<pre><code>#!/usr/bin/env nxshell

TABLE_NAME='MAC Address'

# find mapping table, create if missing
table_id = -1
for t in session.listMappingTables():
    if t.name == TABLE_NAME:
        table_id = t.id
        break
if table_id == -1:
    table_id = session.createMappingTable(TABLE_NAME, 'Lookup table for MAC -&gt; Vendor', 0)

target_table = session.getMappingTable(table_id)

with open('oui.txt', 'r') as f:
    target_table.data.clear()
    for line in f.readlines():
        if "(hex)" in line:
            (mac, _, name) = line.strip().split('\t')
            mac = mac.split(' ')[0].replace('-', ':')
            target_table.data.add(MappingTableEntry(mac, name, None))

session.updateMappingTable(target_table)
</code></pre>
<p dir="auto">Then you can lookup with map() function (in this example - find interface which have primary IP address):</p>
<pre><code>for (i : $node-&gt;interfaces) {
	if (i-&gt;ipAddr == $node-&gt;ipAddr) {
		return map("MAC Address", (substr(i-&gt;macAddr, 0, 8)));
	}
}
</code></pre>
<pre><code>Result: Apple, Inc.
</code></pre>
]]></description><link>https://forum.netxms.org/post/29303</link><guid isPermaLink="true">https://forum.netxms.org/post/29303</guid><dc:creator><![CDATA[alk]]></dc:creator><pubDate>Mon, 18 Jan 2021 15:26:37 GMT</pubDate></item><item><title><![CDATA[Reply to Get mac vendor result as dci on Mon, 18 Jan 2021 14:54:54 GMT]]></title><description><![CDATA[<p dir="auto">Mapping tables might better just for the reason of not disclosing the addresses to 3-rd party and for reliability.</p>
<p dir="auto">You can add this script to script library and then use macro %[name_of_script] to get mac address of that node's interface that has primary IP address.</p>
<pre><code>mac = NULL;
for (i:$node-&gt;interfaces)
{
  if ($node-&gt;ipAddr == i-&gt;ipAddr) mac = i-&gt;macAddr;
}
return mac;
</code></pre>
]]></description><link>https://forum.netxms.org/post/29301</link><guid isPermaLink="true">https://forum.netxms.org/post/29301</guid><dc:creator><![CDATA[Filipp Sudanov]]></dc:creator><pubDate>Mon, 18 Jan 2021 14:54:54 GMT</pubDate></item><item><title><![CDATA[Reply to Get mac vendor result as dci on Mon, 18 Jan 2021 14:30:39 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the example. Why would mapping tables be better choice ?</p>
<p dir="auto">Also seems like no easy way to get node mac address like %{node_primary_ip} ?</p>
<p dir="auto">Egert</p>
]]></description><link>https://forum.netxms.org/post/29299</link><guid isPermaLink="true">https://forum.netxms.org/post/29299</guid><dc:creator><![CDATA[Egert143]]></dc:creator><pubDate>Mon, 18 Jan 2021 14:30:39 GMT</pubDate></item><item><title><![CDATA[Reply to Get mac vendor result as dci on Mon, 18 Jan 2021 13:18:35 GMT]]></title><description><![CDATA[<p dir="auto">On one of the nodes with agent (let's call it "node1") add external parameter:</p>
<p dir="auto">ExternalParameter=ResolveMAC(*):curl -s "<a href="https://api.macvendors.com/$1" rel="nofollow ugc">https://api.macvendors.com/$1</a>"</p>
<p dir="auto">Then add DCI in the template:<br />
Parameter=ResolveMAC(%{node_mac})<br />
Source Node=node1</p>
<p dir="auto">But I'd use mapping tables instead of calling remote service.</p>
]]></description><link>https://forum.netxms.org/post/29298</link><guid isPermaLink="true">https://forum.netxms.org/post/29298</guid><dc:creator><![CDATA[alk]]></dc:creator><pubDate>Mon, 18 Jan 2021 13:18:35 GMT</pubDate></item></channel></rss>