snmp_set_valueretrieval
Description
The snmp_set_valueretrieval of SNMP for PHP specifies the method for how the SNMP values will be returned.
Syntax
snmp_set_valueretrieval( int $method ): true
Parameters
method
Constant | Description |
---|---|
SNMP_VALUE_LIBRARY | The return values will be as returned by the Net-SNMP library. |
SNMP_VALUE_PLAIN | The return values will be the plain value without the SNMP type information. |
SNMP_VALUE_OBJECT | The return values will be objects with the properties value and type, where the latter is one of the SNMP_OCTET_STR, SNMP_COUNTER etc. constants. The way value is returned is based on which one of constants SNMP_VALUE_LIBRARY, SNMP_VALUE_PLAIN is set. |
Return
Always returns true.
Examples
1 · method · SNMP_VALUE_LIBRARY
<? $method = SNMP_VALUE_LIBRARY; $return = snmp_set_valueretrieval($method); var_export($return); ?>
true
2 · method · SNMP_VALUE_PLAIN
<? $method = SNMP_VALUE_PLAIN; $return = snmp_set_valueretrieval($method); var_export($return); ?>
true
3 · method · SNMP_VALUE_OBJECT
<? $method = SNMP_VALUE_OBJECT; $return = snmp_set_valueretrieval($method); var_export($return); ?>
true
4 · snmpget · SNMP_VALUE_LIBRARY
<? $method = SNMP_VALUE_LIBRARY; snmp_set_valueretrieval($method); $hostname = "localhost"; $community = "public"; $object_id = "IF-MIB::ifName.1"; $return = snmpget($hostname, $community, $object_id); var_dump($return); ?>
5 · snmpget · SNMP_VALUE_PLAIN
<? $method = SNMP_VALUE_PLAIN; snmp_set_valueretrieval($method); $hostname = "localhost"; $community = "public"; $object_id = "IF-MIB::ifName.1"; $return = snmpget($hostname, $community, $object_id); var_dump($return); ?>
6 · snmpget · SNMP_VALUE_OBJECT
<? $method = SNMP_VALUE_OBJECT; snmp_set_valueretrieval($method); $hostname = "localhost"; $community = "public"; $object_id = "IF-MIB::ifName.1"; $return = snmpget($hostname, $community, $object_id); var_dump($return); ?>
Links
Related
SNMP
- snmp_get_quick_print
- snmp_get_valueretrieval
- snmp_read_mib
- snmp_set_enum_print
- snmp_set_oid_numeric_print
- snmp_set_oid_output_format
- snmp_set_quick_print
- snmp2_get
- snmp2_getnext
- snmp2_real_walk
- snmp2_set
- snmp2_walk
- snmp3_get
- snmp3_getnext
- snmp3_real_walk
- snmp3_set
- snmp3_walk
- snmpget
- snmpgetnext
- snmprealwalk
- snmpset
- snmpwalk
- snmpwalkoid