downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ソケット> <snmpwalk
Last updated: Fri, 13 Nov 2009

view this page in

snmpwalkoid

(PHP 4, PHP 5)

snmpwalkoidネットワークエンティティに関する情報ツリーを検索する

説明

array snmpwalkoid ( string $hostname , string $community , string $object_id [, int $timeout [, int $retries ]] )

snmpwalkoid() 関数は、hostname で指定した SNMP エージェントから すべてのオブジェクト ID とその値を読みこむために使用します。

snmpwalkoid() および snmpwalk() は、歴史的経緯により残されているものです。 どちらも、下位互換のために提供されています。 代わりに snmprealwalk() を使用してください。

パラメータ

hostname

SNMP エージェント。

community

リードコミュニティ。

object_id

NULL の場合は、object_id が SNMP オブジェクトツリーのルートとして解釈され、 ツリーの配下のすべてのオブジェクトを配列として返します。

object_id を指定した場合は、 その object_id の配下のすべての SNMP オブジェクトを返します。

timeout

retries

返り値

object_id() からの SNMP オブジェクトの値の配列をルートとして返します。 エラーの場合に FALSE を返します。

例1 snmpwalkoid() の例

<?php
$a 
snmpwalkoid("127.0.0.1""public"""); 
for (
reset($a); $i key($a); next($a)) {
    echo 
"$i$a[$i]<br />\n";
}
?>

上記の関数コールは、ローカルホスト上で稼働する SNMP エージェントからすべての SNMP オブジェクトを返します。 ループ処理により値を一つずつとりだすことができます。

参考

  • snmpwalk() - エージェントから全ての SNMP オブジェクトを取得する



ソケット> <snmpwalk
Last updated: Fri, 13 Nov 2009
 
add a note add a note User Contributed Notes
snmpwalkoid
thammer at rtccom dot com
15-Jun-2005 12:29
The above note mentions that the MAC addresses come back converted to integers or something funky like that. Not sure why that is happening but I fixed that with a wrapper function.

function PadMAC($mac) {
    $mac_arr = explode(':',$mac);
    foreach($mac_arr as $atom) {
        $atom = trim($atom);
        $newarr[] = sprintf("%02s",$atom);
    }
    $newmac = implode(':',$newarr);
    return $newmac;
}

Maybe that will help somebody with that issue. I know I personally use the heck out of these user contributed notes
gene_wood at example dot com
15-Oct-2004 01:23
Looks like timeout is in MICRO seconds.
1,000,000 &micros = 1 s
jasper at pointless dot net
07-Jan-2001 12:21
N.B. it's possible for snmpwalkoid to lose data - the "rmon.matrix.matrixSDTable" table for example uses binary mac addresses as part of the index, these get converted to ascii, and by the time they get to php they can be non-unique - so some entrys in the table get lost...

ソケット> <snmpwalk
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites