<?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[Strange behavior of method in API]]></title><description><![CDATA[<p dir="auto">I made a script in python to populate a network, in which I condigure the name, IP, snmp port, snmp community and so.</p>
<p dir="auto">In class org.netxms.client.NXCObjectModificationData, when using the method void setSnmpVersion(int snmpVersion), I noticed the following:</p>
<ul>
<li>If I pass number 1 as a paramether to the method, it configures as version 2c;</li>
<li>If I pass number 2 as a paramether to the method, it configures as version 1.</li>
</ul>
<p dir="auto">Is this supposed to happen? Because of that, in my script I wrote this to configure correctly:</p>
<p dir="auto">    if objectSnmpVersion == "V1":<br />
        objectSnmpVersion = 2<br />
    elif objectSnmpVersion == "V2C":<br />
        objectSnmpVersion = 1<br />
    elif objectSnmpVersion == "V3":<br />
        objectSnmpVersion = 3<br />
    md.setSnmpVersion(objectSnmpVersion)<br />
        <br />
but didnt' like it...  ???</p>
]]></description><link>https://forum.netxms.org/topic/3768/strange-behavior-of-method-in-api</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 08:53:38 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/3768.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 May 2015 11:48:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Strange behavior of method in API on Thu, 14 May 2015 11:45:23 GMT]]></title><description><![CDATA[<p dir="auto">In this situation yes, because we won't monitore this nodes using SNMP, but I made this way so the script can be reused to populate the rest of the nodes!</p>
<p dir="auto">Thank you,<br />
Jhúlia Graziella</p>
]]></description><link>https://forum.netxms.org/post/16868</link><guid isPermaLink="true">https://forum.netxms.org/post/16868</guid><dc:creator><![CDATA[jhuliagraziella]]></dc:creator><pubDate>Thu, 14 May 2015 11:45:23 GMT</pubDate></item><item><title><![CDATA[Reply to Strange behavior of method in API on Wed, 13 May 2015 13:29:39 GMT]]></title><description><![CDATA[<p dir="auto">Btw, is it intended to create all nodes with SNMP access disabled?</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/16857</link><guid isPermaLink="true">https://forum.netxms.org/post/16857</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 13 May 2015 13:29:39 GMT</pubDate></item><item><title><![CDATA[Reply to Strange behavior of method in API on Wed, 13 May 2015 13:25:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/victor" aria-label="Profile: victor">@<bdi>victor</bdi></a> said in <a href="/post/16852">Strange behavior of method in API</a>:</p>
<blockquote>
<p dir="auto">Hi!</p>
<p dir="auto">SNMP version constants are a bit illogical (for historical reasons). They are following:</p>
<p dir="auto">0 = SNMP v1<br />
1 = SNMP v2<br />
3 = SNMP v3</p>
<p dir="auto">2 is an invalid value, so it falls back to v1 (as any invalid value will do). You can use constants from AbstractNode class:</p>
<p dir="auto">AbstractNode.SNMP_VERSION_1, AbstractNode.SNMP_VERSION_2C, AbstractNode.SNMP_VERSION_3</p>
<p dir="auto">Best regards,<br />
Victor</p>
</blockquote>
<p dir="auto">Oh, okay! Thank you very much! <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--smile" style="height:1.4em;width:auto;vertical-align:middle" title=":D" alt="😄" /> I'll correct it.</p>
]]></description><link>https://forum.netxms.org/post/16856</link><guid isPermaLink="true">https://forum.netxms.org/post/16856</guid><dc:creator><![CDATA[jhuliagraziella]]></dc:creator><pubDate>Wed, 13 May 2015 13:25:42 GMT</pubDate></item><item><title><![CDATA[Reply to Strange behavior of method in API on Wed, 13 May 2015 13:24:55 GMT]]></title><description><![CDATA[<p dir="auto">I have attached the script here.<br />
I'm sorry, but all my comments are written in portuguese so here goes a little explanation about the code:</p>
<p dir="auto">In the beggining of the script it's defined the name of the container in which the nodes will be created. It checks if there already is a container with that name and if there isn't we create it. In any case we get the ID of the container of that name.<br />
Then, it opens an archive named input.csv with reading option and mark its delimiter as ';'.<br />
This archive has the following format:</p>
<p dir="auto">NAMEORIP;10.106.7.252;COMMUNITY;0rqu1dea;SNMPPORT;161;SNMPVERSION;V2C;SEEDNAME;a-rg-fcc-arq-001-araraquara;ACCESSMODE;ICMPSNMP;ADDRESSFORMAT;AUTOADDRESS;<br />
NAMEORIP;10.11.133.170;COMMUNITY;0rqu1dea;SNMPPORT;161;SNMPVERSION;V2C;SEEDNAME;a-rg-fcc-ula-085-cadministrativo;ACCESSMODE;ICMPSNMP;ADDRESSFORMAT;AUTOADDRESS;<br />
NAMEORIP;10.224.0.110;SNMPPORT;161;SNMPVERSION;V2C;SEEDNAME;a-rg-fcc-ula-301-image-01;ACCESSMODE;ICMPONLY;ADDRESSFORMAT;AUTOADDRESS;;;<br />
NAMEORIP;10.5.1.132;COMMUNITY;0rqu1dea;SNMPPORT;161;SNMPVERSION;V2C;SEEDNAME;a-rg-fcc-bet-511-guaruja;ACCESSMODE;ICMPSNMP;ADDRESSFORMAT;AUTOADDRESS;<br />
NAMEORIP;10.5.1.134;SNMPPORT;161;SNMPVERSION;V2C;SEEDNAME;a-rg-fcc-bhe-010-liberdade;ACCESSMODE;ICMPONLY;ADDRESSFORMAT;AUTOADDRESS;;;</p>
<p dir="auto">Above there are some lines of the archive. It's in this format because this is how it was exported by our running network management system (yeah I know it looks ugly!). As you can see, not all collumns are filled for all lines, and the names in upercase letters represent what parameter comes next, so we "treat" this in the if-chain by reading 2 collumns at a time and checking what that collumn represents. We save the data collected in variables.</p>
<p dir="auto">Then it's the creation part:<br />
First it checks if an object with that name already exists. If so, it doesn't create it. If not, it calls the methods of classes NXCObjectCreationData and NXCObjectModificationData and create it with the parameters got from the archive.</p>
<p dir="auto">Sorry about my not-so-good english, hope I made it clear!  ;D<br />
If you have any questions about anything feel free to ask me, I'll be glad to explain!</p>
<p dir="auto">Regards,</p>
<p dir="auto">Jhúlia Graziella</p>
<hr />
<p dir="auto"><a href="/assets/uploads/files/smf/0000000002290-popular-formatoSmarts.py">popular-formatoSmarts.py</a></p>
]]></description><link>https://forum.netxms.org/post/16854</link><guid isPermaLink="true">https://forum.netxms.org/post/16854</guid><dc:creator><![CDATA[jhuliagraziella]]></dc:creator><pubDate>Wed, 13 May 2015 13:24:55 GMT</pubDate></item><item><title><![CDATA[Reply to Strange behavior of method in API on Wed, 13 May 2015 13:12:11 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">SNMP version constants are a bit illogical (for historical reasons). They are following:</p>
<p dir="auto">0 = SNMP v1<br />
1 = SNMP v2<br />
3 = SNMP v3</p>
<p dir="auto">2 is an invalid value, so it falls back to v1 (as any invalid value will do). You can use constants from AbstractNode class:</p>
<p dir="auto">AbstractNode.SNMP_VERSION_1, AbstractNode.SNMP_VERSION_2C, AbstractNode.SNMP_VERSION_3</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/16852</link><guid isPermaLink="true">https://forum.netxms.org/post/16852</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 13 May 2015 13:12:11 GMT</pubDate></item><item><title><![CDATA[Reply to Strange behavior of method in API on Wed, 13 May 2015 08:48:48 GMT]]></title><description><![CDATA[<p dir="auto">can you show a full version of your script?</p>
]]></description><link>https://forum.netxms.org/post/16849</link><guid isPermaLink="true">https://forum.netxms.org/post/16849</guid><dc:creator><![CDATA[joni]]></dc:creator><pubDate>Wed, 13 May 2015 08:48:48 GMT</pubDate></item></channel></rss>