Next Topic

Previous Topic

Book Contents

Get

string Get(string sOID,int iSyntax)

Return values

A string with the value fetched from the remote SNMP agent.

Parameters

  • sOID - OID to use in Get operation. When querying an interface the @ operator can be used to specify the interface index.

    Example of usage of @ operator:

	iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets@NVIDIA nForce Networking Controller

Example of normal OID

	iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifInOctets.1
  • iSyntax - Specifies the format of the returned data. Can be one of the following constants.
  • SNMP_NOSYNTAX
  • SNMP_IPADDRESS
  • SNMP_INTEGER
  • SNMP_UNSIGNED32
  • SNMP_COUNTER32
  • SNMP_GAUGE32
  • SNMP_TIMETICKS
  • SNMP_OPAQUE
  • SNMP_OCTETSTRING
  • SNMP_DATA_AS_HEXSTRING

Reading binary values

Some OID's may return binary data instead of for example a string or integer, this can be a problem since the Get function returns a null terminated string. A solution for this problem is to settings the iSyntax variable to SNMP_DATA_AS_HEXSTRING. The function will then return the binary data hexadecimal encoded.

Example of three hexadecimal encoded bytes

49 4E4D