Obtaining device information through SNMP
Subscription and execution phases
result1_value, result2_description = ops.snmp.get(oid)
Parameter |
Description |
Value |
---|---|---|
oid |
Indicates the OID and index of a leaf object. |
The value is a string of 1 to 1047 characters. The format is leaf object OID.leaf object index |
The result1_value and result2_description in the API prototype indicate return values.
If the first return value is None, device information fails to be obtained. If the first return value is not None, device information is obtained successfully.
The second return value is the failure cause when the first return value is None.
This API enables you to obtain the detailed information about a leaf object with the specified OID.
When a subscription event is matched, you can obtain the detailed information about the leaf object whose OID is 1.3.6.1.2.1.1.3 and whose index is 0.
value, descri_str = ops.snmp.get("1.3.6.1.2.1.1.3.0")