Timeout is in MICRO seconds.
1,000,000 µs = 1 s
PHP.mk документација
snmpwalk
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Патека
function.snmpwalk.php
Локална патека за оваа страница.
Извор
php.net/manual/en
Оригиналниот HTML се реупотребува и локално се стилизира.
Режим
Прокси + превод во позадина
Кодовите, табелите и белешките остануваат читливи во истиот тек.
Референца
function.snmpwalk.php
snmpwalk
Референца за `function.snmpwalk.php` со подобрена типографија и навигација.
snmpwalk
(PHP 4, PHP 5, PHP 7, PHP 8)
snmpwalk — Преземи ги сите SNMP Преземи ги сите
= NULL
snmpwalk(
string
string
array|string
int
int
): array|false
string
$hostname,string
$community,array|string
$object_id,int
$timeout = -1,int
$retries = -1): array|false
snmpwalk() објекти од агент SNMP функцијата се користи за читање на сите вредности од hostname.
Параметри
hostname- SNMP агентот (сервер).
community- агент (сервер).
object_id-
Враќа
null,object_idИмето на домаќинот на SNMP агентот (сервер). SNMP се зема како корен на Враќаobject_idдрвото на објекти и сите објекти под тоа дрво се враќаат како низа. SNMP е специфицирано, ситеobject_idсе враќаат. timeout- ID на објект што му претходи на посакуваниот.
retries- Бројот на микросекунди до првиот тајмаут.
Вратени вредности
Враќа низа од SNMP објекти под тоа
object_id вредности на објекти почнувајќи од false при грешка.
Примери
Пример #1 snmpwalk() Пример
<?php
$a = snmpwalk("127.0.0.1", "public", "");
foreach ($a as $val) {
echo "$val\n";
}
?>како корен или SNMP Горниот повик на функцијата би вратил сè SNMP агент кој работи на localhost. Може да се поминува низ вредностите со циклус
Види Исто така
- snmprealwalk() агент што работи на localhost:
Белешки од корисници 10 белешки
Стивен Коуп ¶
пред 23 години
Note that there's different behaviuor in php snmpwalk and ucd snmpwalk. If you try to walk an oid that has one value not under a subkey of the walked oid, ucd snmpwalk will return the value while php's snmpwalk will not.
anders at ei dot nu ¶
пред 23 години
It would be nice to be able to specify what snmp version to use ( 1,2c,3 )
For now, I'ts hardcoded in ext/snmp/snmp.c
change session.version from 1 to 2c or 3 if you need for now..
i.e
session.version = SNMP_VERSION_1;
to:
session.version = SNMP_VERSION_2c;
smcbride на msn точка com ¶
пред 1 година
snmpwalk and other snmp functions really need to support an optional port.
In the corporate world it is very common to change the port for SNMP from 161 to some other port for security. It is a simple security obfuscation, but a lot of bots will scan well known ports for attack vectors. For example, we used to change ours to something like 1161 just to prevent making it easy.
layer2 at www dot com ¶
figroc at gmail dot com
Something to care about in dealing with snmpwalk:<BR>
While walking the MIB, snmpwalk puts info that gets into an array, and that is correct.<BR>
The trouble happened when snmpwalk needs to collect information from instances that contains subinstances (i.e. walking .1.2.3.4.5 and having instances like 1.1, 1.2, 1.3): in this case it gets info and passes into an array, but when walking the array, each value is preceeded by 'Counter32: '.<BR>
I've tested this in many ways and it always happened the same way.
john at antefacto dot com ¶
figroc at gmail dot com
Ah. That's why all of our SNMP stuff was timing out anytime there was any load on the system. Sigh. A waste of two weeks trying to debug snmp....
Even the snmpcmd manpage doesn't give a
unit for timeout.
billf at freebsd dot org ¶
figroc at gmail dot com
for the poster wondering what the
timeout field was measured in:
from the ucd-snmp header file snmp_api.h:
long timeout;
/* Number of uS until first timeout
then exponential backoff */
jmartinson(AT_nospam)info234.com ¶
figroc at gmail dot com
A quick router device view:
<?
include "header.html";
$host = "auscr1";
$community = "tellme";
$sysDescr = snmpget("$host","$community","system.sysDescr.0");
$ifDescr = snmpwalk("$host","$community","interfaces.ifTable.ifEntry.ifDescr");
$ifIndex = snmpwalk("$host","$community","interfaces.ifTable.ifEntry.ifIndex");
$ifAdminStatus = snmpwalk("$host","$community","interfaces.ifTable.ifEntry.ifAdminStatus");
$ifOperStatus = snmpwalk("$host","$community","interfaces.ifTable.ifEntry.ifOperStatus");
$ifLastChange = snmpwalk("$host","$community","interfaces.ifTable.ifEntry.ifLastChange");
print "<table border=1 bgcolor=#ffffff><tr><td>$host</td></tr></table><br>";
print "<table border=1 bgcolor=#ffffff><tr><td>$sysDescr</td></tr></table><br>";
print "<table border=1 bgcolor=#ffffff>";
print "<tr>
<td>ifIndex</td>
<td>ifDescr</td>
<td>ifAdminStatus</td>
<td>ifOperStatus</td>
<td>ifLastChange</td>
</tr>";
for ($i=0; $i<count($ifIndex); $i++) {
print "<tr>";
print "<td>$ifIndex[$i]</td>";
print "<td>$ifDescr[$i]</td>";
print "<td>$ifAdminStatus[$i]</td>";
print "<td>$ifOperStatus[$i]</td>";
print "<td>$ifLastChange[$i]</td>";
print "</tr>";
}
print "</table>";
?>
http://mike.eire.ca ¶
21 години пред
I found on Windows (PHP 5) an empty string did not return anything, it just timed out. I had to use null instead:
<?php
$a = snmpwalk("127.0.0.1", "public", null);
?>
bobby [dot] clark [at] eku [dot] edu ¶
пред 22 години
I had to use an object_id like these.
'SNMPv2-MIB::system.sysDescr.0'
'IF-MIB::interfaces.ifTable.ifEntry.ifAdminStatus'
<?php
$host = '192.168.1.1';
$community = 'public';
$object_id = 'IF-MIB::interfaces.ifTables.ifEntry.ifAdminStatus';
$sysdesc = snmpwalk($host, $community', $object_id);
print_r($sysdesc);
?>