snmpwalkoid

(PHP 4, PHP 5, PHP 7, PHP 8)

snmpwalkoidSolicitud de información de árbol sobre una entidad de la red

Descripción

snmpwalkoid(
    string $hostname,
    string $community,
    array|string $object_id,
    int $timeout = -1,
    int $retries = -1
): array|false

snmpwalkoid() se utiliza para leer todos los identificadores de objetos así como sus valores respectivos desde el agente SNMP especificado por hostname.

La existencia de snmpwalkoid() y snmpwalk() tiene razones históricas. Ambas funciones proporcionan compatibilidades ascendentes. Utilice en su lugar la función snmprealwalk().

Parámetros

hostname

El agente SNMP.

community

La comunidad de lectura.

object_id

Si null, object_id se toma como raíz de los objetos SNMP y todos los objetos de este árbol se devuelven en forma de array.

Si object_id se especifica, todos los objetos SNMP siguientes a este object_id se devuelven.

timeout

El número de microsegundos desde el primer timeout.

retries

El número de intentos en caso de que ocurra el tiempo límite máximo.

Valores devueltos

Devuelve un array asociativo que contiene los identificadores de los objetos así como sus valores respectivos, a partir de object_id, o false si ocurre un error.

Ejemplos

Ejemplo #1 Ejemplo con snmpwalkoid()

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

La llamada a la función anterior devolverá todos los objetos SNMP desde el agente SNMP ejecutado en el host local. Se recorren los valores mediante un bucle.

Ver también

  • snmpwalk() - Recibe todos los objetos SNMP de un agente

add a note

User Contributed Notes 4 notes

up
0
Anonymous
10 years ago
make sure you install "snmp-mibs-downloader" in debian.

apt-get install snmp-mibs-downloader

you my also need to edit your /etc/apt/sources.list

deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free
up
0
thammer at rtccom dot com
19 years ago
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
up
0
gene_wood at example dot com
20 years ago
Looks like timeout is in MICRO seconds.
1,000,000 &micros = 1 s
up
0
jasper at pointless dot net
24 years ago
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...
To Top