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 — Abfrage über einen Baum einer Netzwerkeinheit.
Beschreibung
$hostname
, string $community
, string $object_id
[, int $timeout
[, int $retries
]] )
Gibt ein assoziatives Array mit den Objekt Ids und den dazugehörigen
Objektwerten zurück, der mit der object_id als
Wurzel beginnt, oder FALSE bei einem Fehler.
Die snmpwalkoid() Funktion wird verwendet um alle Werte
von dem SNMP Agenten zu lesen, der bei hostname
angegeben wurde. Der Community Parameter bestimmt
die Lese-"Community" für diesen Agenten. Ein NULL
object_id wird als Wurzel des SNMP Objektbaums
verwendet und alle Objekts unter diesem Baum als ein Array zurückgegeben.
Wenn object_id angegeben wird, werden alle SNMP
Objekte unterhalb der object_id zurückgegeben.
Die Existenz von snmpwalkoid() und snmpwalk() hat historische Gründe. Beide Funktionen gibt es aus Kompatiblitätsgründen.
$a = snmpwalkoid("127.0.0.1", "public", "");
Der obige Funktionsaufruf gibt alle SNMP Objekte des Agenten, der auf localhost läuft, zurück. Man kann mit einer Schleife alle Werte durchlaufen.
for ($i=0; $i < count($a); $i++) {
echo $a[$i];
}
Looks like timeout is in MICRO seconds.
1,000,000 µs = 1 s
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...
