Home > Backend Development > PHP Tutorial > PHP使用SNMP相关函数的有关问题

PHP使用SNMP相关函数的有关问题

WBOY
Release: 2016-06-13 10:36:17
Original
984 people have browsed it

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'不存在。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template