|
SnmpGet
snmppdu
SnmpGet(string
ipAddress, string community,
intretries,
inttimeout,
snmppdupdu)
snmppdu
SnmpGet(string
ipAddress, string community,
intretries,
inttimeout,
snmppdupdu,
int version)
snmppdu
SnmpGet(string
ipAddress, intretries,
inttimeout, snmppdupdu,
int securityLevel, string userName,
string contextName)
snmppdu
SnmpGet(string
ipAddress, intretries,
inttimeout, snmppdupdu,
int securityLevel, string userName,
string contextName, int authProtocol,
string authPassword)
snmppdu
SnmpGet(string
ipAddress, intretries,
inttimeout, snmppdupdu,
int securityLevel, string userName,
string contextName,
int authProtocol, string authPassword,
int privProtocol, string
privPassword)
Return
Value
Returns a response SNMP PDU.
Parameters
ipAddress
–the IP address
of the SNMP agent.
Note: The
following syntax of ipAddress provides the ability to specify the
SNMP port value: ipAddress:Port
Example:
“65.35.64.170:2000”
If SNMP port
is not specified explicitly, default value (161) is
considered.
community
–the community
string to access SNMP data on the agent.
retries
–the number of
retries to repeat operation.
timeout
–the operation
timeout.
pdu
–the SNMP PDU
that contains SNMP variables (e.g. 1.3.6.1.2.1.1.1.0 - sysDescr) to
execute SNMP GET operation for.
version –the
version of SNMP protocol to be used. Can be one of the following
constants:
securityLevel
–the
security level used to access the agent.Can be one of the
following constants:
-
USM_NOAUTHNOPRIV
-
USM_AUTHNOPRIV
-
USM_AUTHPRIV
userName
–the USM
user name - the principal on whose behalf access is requested.
contextName
–the
name of an SNMP Context - the collection of management
information accessible by an SNMP entity.
authProtocol
–the
authentication protocol that is used to authenticate the user. Two
protocols are currently supported: the HMAC-MD5-96 and
HMAC-SHA-96.Can be one of the following constants:
authPassword
–the
password required for authentication service.
privProtocol
–the
privacy protocol that is used to protect the message from
disclosure. Two protocols are currently supported: the CBC-DES
Symmetric Encryption Protocol and CFB-AES-128. Can be one of the
following constants:
privPassword
–the
password required for privacy (encryption) service.
Remarks
Call this
function to perform SNMP GET. Use GetPduErrorStatus function to
check if there was an error during the operation. (e.g. SNMP
Timeout, etc.). If there were no errors during the operation the
error status will be equal to 0. For more details about possible
errors see GetPduErrorStatus description.
Note:If there
was a timeout the error status will be equal to 1000.
Example
snmpvar
var1 = CreateVar("1.3.6.1.2.1.1.1.0")
snmpvar
var2 = CreateVar("1.3.6.1.2.1.1.2.0")
snmppdu
pdu = CreatePdu(var1, var2),
response
int
iVarCount
int
iIndex
snmpvar
var_tmp
response = SnmpGet("65.35.64.170", "public", 2, 3000,
pdu, SNMPV1)
iVarCount = GetVarCount(response)
for
(iIndex=0; iIndex <
iVarCount; iIndex++)
var_tmp =
GetVarAt(response,
iIndex)
Println("OID:
", GetVarOID(var_tmp))
Println("VALUE: ", GetVarValue(var_tmp))
endfor
Output of the example script will look
like:
OID: 1.3.6.1.2.1.1.1.0
VALUE: Test
OID: 1.3.6.1.2.1.1.2.0
VALUE: 1.3.6.1.4.1.311.1.1.3.1.1
|