<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.netio-products.com/index.php?action=history&amp;feed=atom&amp;title=Function_snmpGet%28%29</id>
	<title>Function snmpGet() - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.netio-products.com/index.php?action=history&amp;feed=atom&amp;title=Function_snmpGet%28%29"/>
	<link rel="alternate" type="text/html" href="https://wiki.netio-products.com/index.php?title=Function_snmpGet()&amp;action=history"/>
	<updated>2026-04-14T21:15:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>https://wiki.netio-products.com/index.php?title=Function_snmpGet()&amp;diff=392&amp;oldid=prev</id>
		<title>Phrych at 10:26, 20 June 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.netio-products.com/index.php?title=Function_snmpGet()&amp;diff=392&amp;oldid=prev"/>
		<updated>2019-06-20T10:26:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 10:26, 20 June 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot; &gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Execute SNMP GET call to given host and oid to read the response. The call is asynchronous: the code execution proceeds immediately and when the response arrives, callback function is called.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Execute SNMP GET call to given host and oid to read the response. The call is asynchronous: the code execution proceeds immediately and when the response arrives, callback function is called.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;i&amp;gt;nil&amp;lt;/i&amp;gt; &amp;lt;b&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;devices.system.&lt;/del&gt;snmpGet&amp;lt;/b&amp;gt;(&amp;lt;i&amp;gt;table&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;i&amp;gt;nil&amp;lt;/i&amp;gt; &amp;lt;b&amp;gt;snmpGet&amp;lt;/b&amp;gt;(&amp;lt;i&amp;gt;table&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Parameters ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Parameters ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Phrych</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.netio-products.com/index.php?title=Function_snmpGet()&amp;diff=382&amp;oldid=prev</id>
		<title>Phrych: Created page with &quot;{{DISPLAYTITLE:function snmpGet()}} Execute SNMP GET call to given host and oid to read the response. The call is asynchronous: the code execution proceeds immediately and whe...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.netio-products.com/index.php?title=Function_snmpGet()&amp;diff=382&amp;oldid=prev"/>
		<updated>2019-06-19T14:25:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{DISPLAYTITLE:function snmpGet()}} Execute SNMP GET call to given host and oid to read the response. The call is asynchronous: the code execution proceeds immediately and whe...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{DISPLAYTITLE:function snmpGet()}}&lt;br /&gt;
Execute SNMP GET call to given host and oid to read the response. The call is asynchronous: the code execution proceeds immediately and when the response arrives, callback function is called.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;i&amp;gt;nil&amp;lt;/i&amp;gt; &amp;lt;b&amp;gt;devices.system.snmpGet&amp;lt;/b&amp;gt;(&amp;lt;i&amp;gt;table&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
 &amp;lt;i&amp;gt;table&amp;lt;/i&amp;gt; config{&amp;lt;code&amp;gt;host&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;oid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;callback&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;snmpVersion&amp;lt;/code&amp;gt;,&amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt;, &amp;lt;code style=&amp;quot;color: #777&amp;quot;&amp;gt;timeout&amp;lt;/code&amp;gt;}&lt;br /&gt;
* &amp;lt;i&amp;gt;string&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;host&amp;lt;/code&amp;gt; host IP adress, may contain transport protocol and port (for example tcp:myhost.com:162)&lt;br /&gt;
* &amp;lt;i&amp;gt;string&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;oid&amp;lt;/code&amp;gt; object identifier&lt;br /&gt;
* &amp;lt;i&amp;gt;function{response}&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;callback&amp;lt;/code&amp;gt; this function is called when response arrives&lt;br /&gt;
* &amp;lt;i&amp;gt;string&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;snmpVersion&amp;lt;/code&amp;gt; version of SNMP (SNMP_VERSION.Snmp1 or SNMP_VERSION.Snmp2c)&lt;br /&gt;
* &amp;lt;i&amp;gt;string&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; SNMP community string&lt;br /&gt;
* optional &amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;timeout&amp;lt;/code&amp;gt; maximum seconds to wait for response (default 30)&lt;br /&gt;
&lt;br /&gt;
=== Callback Parameters ===&lt;br /&gt;
 &amp;lt;i&amp;gt;table&amp;lt;/i&amp;gt; response{&amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;errorInfo&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;oid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;}&lt;br /&gt;
* &amp;lt;i&amp;gt;number&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt; error code of the response (0 is success)&lt;br /&gt;
* &amp;lt;i&amp;gt;string&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;errorInfo&amp;lt;/code&amp;gt; error description (if result&amp;gt;0)&lt;br /&gt;
* &amp;lt;i&amp;gt;string&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;oid&amp;lt;/code&amp;gt; oid we got&lt;br /&gt;
* &amp;lt;i&amp;gt;string&amp;lt;/i&amp;gt; &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; value for the oid&lt;br /&gt;
&lt;br /&gt;
=== Return value ===&lt;br /&gt;
 nil&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
 -- switch all outputs on NETIO with IP in 'host' parameter&lt;br /&gt;
 local function snmpcallback(data)&lt;br /&gt;
   if data.result == 0 then&lt;br /&gt;
     output=tonumber(string.sub(data.oid, -1))&lt;br /&gt;
     outputStatus=tonumber(data.value)&lt;br /&gt;
     devices.system.SetOut{output=output, value=(outputStatus == 0)}&lt;br /&gt;
   else&lt;br /&gt;
        log(string.format(&amp;quot;snmpget failed with error %d: %s&amp;quot;, data.result, data.errorInfo))&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 for i = 1,4 do&lt;br /&gt;
   snmpGet{host='10.0.0.102', timeout=6, oid=string.format(&amp;quot;.1.3.6.1.4.1.47952.1.1.1.3.%d&amp;quot;, i), snmpVersion=SNMP_VERSION.Snmp1, community='public', callback=snmpcallback}&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requirements ===&lt;br /&gt;
Netio FirmWare 3.3.0+&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Phrych</name></author>
		
	</entry>
</feed>