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

search for in the

Sockets> <SNMP Functions
Last updated: Fri, 22 Aug 2008

view this page in

snmpwalkoid

(PHP 4, PHP 5)

snmpwalkoidBusqueda por un arbol de información acerca de un entidad de red

Descripción

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

Devuelve una matriz asociativa con los identificadores de los objetos y sus respectivos valores comenzando por el object_id como raíz y FALSE en caso de error.

La función snmpwalkoid() es usada para leer todos los identificadores de objetos y sus respectivos valores de un agente SNMP especificado por el nombre del servidor. La lectura de community especifica la comunidad para el agente. Un object_id nulo es tomado como la raíz del arbol de objetos SNMP y todos los objetos por debajo de este arbol son devueltos como una matriz. Si object_id es especificado, todos los objetos SNMP inferiores al object_id son devueltos.

La existencia de snmpwalkoid() y snmpwalk() tiene razones historicas. Ambas funciones son proporcionadas para compatibilidad hacia atrás.

$a = snmpwalkoid("127.0.0.1", "public", "");

La llamada a las funciones superiores devuelve todos los objetos SNMP del agente SNMP en ejecución en el servidor local. Uno puede pasar por todos los valores con un bucle.

for (reset($a); $i = key($a); next($a)) {
    echo "$i: $a[$i]<br>\n";
}



Sockets> <SNMP Functions
Last updated: Fri, 22 Aug 2008
 
add a note add a note User Contributed Notes
snmpwalkoid
thammer at rtccom dot com
14-Jun-2005 05: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
14-Oct-2004 06:23
Looks like timeout is in MICRO seconds.
1,000,000 &micros = 1 s
jasper at pointless dot net
07-Jan-2001 04: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...

Sockets> <SNMP Functions
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites