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

search for in the

Sockets> <snmpwalk
Last updated: Fri, 14 Aug 2009

view this page in

snmpwalkoid

(PHP 4, PHP 5)

snmpwalkoidDemande d'informations d'arbre sur une entité du réseau

Description

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

snmpwalkoid() est utilisé pour lire tous les identifiant d'objets ainsi que leurs valeurs respectives depuis l'agent SNMP spécifié par hostname .

L'existence de snmpwalkoid() et snmpwalk() a des raisons historiques. Les deux fonctions fournissent des compatibilités ascendantes. Utilisez plutôt la fonction snmprealwalk().

Liste de paramètres

hostname

L'agent SNMP.

community

La communauté de lecture.

object_id

Si NULL, object_id est pris comme racine des objets SNMP et tous les objets de cet arbre sont retournés sous la forme d'un tableau.

Si object_id est spécifié, tous les objets SNMP suivant cet object_id sont retournés.

timeout

retries

Valeurs de retour

Retourne un tableau associatif contenant les identifiants des objets ainsi que leurs valeurs respectives, à partir de object_id , ou FALSE si une erreur survient.

Exemples

Exemple #1 Exemple avec snmpwalkoid()

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

L'appel à la fonction ci-dessus retournera tous les objets SNMP depuis l'agent SNMP exécuté sur l'hôte local. On parcourt les valeurs via une boucle.

Voir aussi

  • snmpwalk() - Reçoit tous les objets SNMP d'un agent



Sockets> <snmpwalk
Last updated: Fri, 14 Aug 2009
 
add a note add a note User Contributed Notes
snmpwalkoid
thammer at rtccom dot com
14-Jun-2005 03: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 04:23
Looks like timeout is in MICRO seconds.
1,000,000 &micros = 1 s
jasper at pointless dot net
07-Jan-2001 03: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> <snmpwalk
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites