Skip to content

SNMP Calls

Name Input Params Return Data Description
resiot_snmp_get String, Integer, String, String, String, Integer, Integer String, String Makes an SNMP Call with the given parameters

resiot_snmp_get(String, Integer, String, String, String, Integer, Integer)

Makes an SNMP Call with the given parameters
Example
Result, Error = resiot_snmp_get(Host, Port, Version, Community, Oid, Timeout, Retries)
Input Parameters
 - Host (String): * The address of the network where the SNMP server you want to read from is.
 - Port (Integer): * Port SNMP Server.

 - Version (String): * SNMP Server Version. Accepted values 1 or 2 or 3.
 - Community (String): * SNMP Community.

 - Oid (String): * Oid SNMP.
 - Timeout (Integer): * Time in seconds before the timeout of the call.

 - Retries (Integer): * Retries before timeout.
Returns
 - Result (String): * Contains the result of the call if it was successful

 - Error (String): * Empty if the call was successful, otherwise contains the reason of the error *

Host = "0.0.0.0"        -- The address of the network where the SNMP server you want to read from is
Port = 161              -- Port SNMP Server
Version="2"             -- SNMP Server Version. Accepted values 1 or 2 or 3
Community="public"      -- SNMP Community
Oid="1.3.6.1.2.1.1.4.0" -- Oid SNMP
Timeout = 2             -- Time in seconds before the timeout of the call
Retries = 3             -- Retries before timeout

Result, Error = resiot_snmp_get(Host,Port,Version,Community,Oid,Timeout,Retries)
if Error ~= "" then
    -- error 
    resiot_debug(Error)
else
    -- value read correctly
    resiot_debug(Result)
end

Return to index