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
snmpwalkoid
(PHP 4, PHP 5)
snmpwalkoid — Demande d'informations d'arbre sur une entité du réseau
Description
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.
snmpwalkoid
14-Jun-2005 05:29
14-Oct-2004 06:23
Looks like timeout is in MICRO seconds.
1,000,000 µs = 1 s
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...
