示例显示的是接口状态。
(.iso.org.dod.internet.mgmt.mib-2.
interfaces.ifTable.ifEntry.ifAdminStatus)
此请求从 MIB 获取的可能值
Enum(整数): up (1), down (2), testing (3)
<?php
$strIP = "10.1.1.1"; $strComm = "public";
$strOID = ".1.3.6.1.2.1.2.2.1.7.1";
echo "\n 默认 valueretrieval with snmp_set_quick_print(0)";
echo " snmp_get_valueretrieval = SNMP_VALUE_LIBRARY";
echo ", retrieved value " . snmpget($strIP, $strComm, $strOID);
snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
echo "\n SNMP_VALUE_LIBRARY " . snmp_get_valueretrieval();
echo ", retrieved value " . snmpget($strIP, $strComm, $strOID);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "\n SNMP_VALUE_PLAIN " . snmp_get_valueretrieval();
echo ", retrieved value " . snmpget($strIP, $strComm, $strOID);
snmp_set_quick_print(1);
echo "\n Default valueretrieval snmp_set_quick_print(0) " ;
snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
echo "\n SNMP_VALUE_LIBRARY " . snmp_get_valueretrieval();
echo ", retrieved value " . snmpget($strIP, $strComm, $strOID);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "\n SNMP_VALUE_PLAIN " . snmp_get_valueretrieval();
echo ", retrieved value " . snmpget($strIP, $strComm, $strOID);
?>
结果
默认 valueretrieval with snmp_set_quick_print(0)
snmp_get_valueretrieval = SNMP_VALUE_LIBRARY,
retrieved value up(1)
SNMP_VALUE_LIBRARY 0, retrieved value up(1)
SNMP_VALUE_PLAIN 1, retrieved value 1
默认 valueretrieval snmp_set_quick_print(0)
SNMP_VALUE_LIBRARY 0, retrieved value up
SNMP_VALUE_PLAIN 1, retrieved value 1