PHP使用SNMP相關函數的有關問題

來源:互聯網
上載者:User
PHP使用SNMP相關函數的問題
SNMP服務已經配置好了

使用PHP_SNMP.DLL模組

使用函數 SNMPWALK

原代碼如下
$a = snmpwalkoid("127.0.0.1", "public", "");
?>


for (reset($a); $i = key($a); next($a)) {
echo "$i: $a[$i]
\n";
}
?>
這個是沒問題的 但是一旦指定相關OBJECT就會出問題 SNMPWALK協助文檔提供的原代碼中

$host = '127.0.0.1';
$community = 'public';
$object_id = 'IF-MIB::interfaces.ifTables.ifEntry.ifAdminStatus';

$sysdesc = snmpwalk($host, $community, $object_id);
print_r($sysdesc);
?>

提示SNMPWALK出錯
但是是有東西輸出的

錯誤資訊 Warning: snmpwalk() [function.snmpwalk]: Invalid object identifier: IF-MIB::interfaces.ifTables.ifEntry.ifAdminStatus in E:\work\php\black\snmpwalk3.php on line 6

輸出資訊
Array ( [0] => "Windows WWW-476F9BE6F90 5.1.2600 Service Pack 3 XP Professional x86 Family 6 Model 23 Stepping 10" [1] => OID: enterprises.8072.3.2.13 [2] => Timeticks: (138255) 0:23:02.55 [3] => "Me " [4] => "WWW-476F9BE6F90" [5] => "Right here, right now." [6] => Timeticks: (4) 0:00:00.04 [7] => OID: 31 [8] => OID: 49 [9] => OID: 4 [10] => OID: 50 [11] => OID: .iso.org.dod.internet.snmpV2.snmpModules.1 [12] => OID: .iso.org.dod.internet.snmpV2.snmpModules.16.2.2.1 [13] => OID:

求協助

------解決方案--------------------
'IF-MIB::interfaces.ifTables.ifEntry.ifAdminStatus'
當初我也碰到這個問題了。
網上找到的都是這種表達方式,好像是linux系統專用的。
windows系統下,需要用.iso.開頭的地址,或者0.1.3.6數字形式的。
iso就是1.

Invalid object identifier就是表示這個'IF-MIB::interfaces.ifTables.ifEntry.ifAdminStatus'不存在。
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.