PHP 8.1.28 Released!

snmpgetnext

(PHP 5, PHP 7, PHP 8)

snmpgetnext 指定したオブジェクト ID に続く SNMP オブジェクトを取得する

説明

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

snmpgetnext() 関数は、 object_id で指定したオブジェクトに続く SNMP オブジェクトの値を取得します。

パラメータ

hostname

SNMP エージェント (サーバー) のホスト名。

community

リードコミュニティ。

object_id

前にある SNMP オブジェクトの ID。

timeout

最初のタイムアウトまでのマイクロ秒数。

retries

タイムアウト発生時の再試行回数。

戻り値

成功した場合に SNMP オブジェクトの値、エラー時に false を返します。 エラー時には E_WARNING が発生します。

例1 snmpgetnext() の使用法

<?php
$nameOfSecondInterface
= snmpgetnetxt('localhost', 'public', 'IF-MIB::ifName.1');
?>

参考

  • snmpget() - SNMP オブジェクトを取得する
  • snmpwalk() - エージェントから全ての SNMP オブジェクトを取得する

add a note

User Contributed Notes 1 note

up
-2
achalsaraiya at yahoo dot co dot in
14 years ago
with snmpget api, the agent returns the value associated
with the OID (or OIDs) specified in the original request.
The snmpgetnext api is similar, but the agent returns the
value associated with the next (valid) OID

eg:
snmpgetnext('192.168.40.134',
'public',
'SNMPv2-MIB::sysUpTime.0');

will give the output:
STRING: user@hostname
To Top