snmpget是取具体的OID的值。(适用于OID值是一个叶子节点的情况)

snmpwalk

snmpwalk — Fetch all the objects from an agent

<?php
$a = snmpwalk("127.0.0.1", "public", "");
foreach ($a as $val) {
    echo "$val\n";
}
?>

 

snmprealwalk

snmprealwalk — 返回一个该oid对应的子oid和其值 组成的 关联数组,,其返回的是关联数组,也是其和snmpwalk主要的区别

<?php
 print_r(snmprealwalk("localhost", "public", "IF-MIB::ifName"));
?>
 
 Array
(
[IF-MIB::ifName.1] => STRING: lo
[IF-MIB::ifName.2] => STRING: eth0
[IF-MIB::ifName.3] => STRING: eth2
[IF-MIB::ifName.4] => STRING: sit0
[IF-MIB::ifName.5] => STRING: sixxs
)
04-16 03:16