array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.snmp-read-mib.php', 1 => 'snmp_read_mib', 2 => 'Reads and parses a MIB file into the active MIB tree', ), 'up' => array ( 0 => 'ref.snmp.php', 1 => 'SNMP 函数', ), 'prev' => array ( 0 => 'function.snmp-get-valueretrieval.php', 1 => 'snmp_get_valueretrieval', ), 'next' => array ( 0 => 'function.snmp-set-enum-print.php', 1 => 'snmp_set_enum_print', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/snmp/functions/snmp-read-mib.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

snmp_read_mib

(PHP 5, PHP 7, PHP 8)

snmp_read_mib Reads and parses a MIB file into the active MIB tree

说明

snmp_read_mib(string $filename): bool

This function is used to load additional, e.g. vendor specific, MIBs so that human readable OIDs like VENDOR-MIB::foo.1 instead of error prone numeric OIDs can be used.

The order in which the MIBs are loaded does matter as the underlying Net-SNMP library will print warnings if referenced objects cannot be resolved.

参数

filename

The filename of the MIB.

返回值

成功时返回 true, 或者在失败时返回 false

示例

示例 #1 Using snmp_read_mib()

<?php
print_r
( snmprealwalk('localhost', 'public', '.1.3.6.1.2.1.2.3.4.5') );

snmp_read_mib('./FOO-BAR-MIB.txt');
print_r( snmprealwalk('localhost', 'public', 'FOO-BAR-MIB::someTable') );
?>

The above example is made up but the results would look like:

Array
(
    [iso.3.6.1.2.1.2.3.4.5.0] => Gauge32: 6
)
Array
(
    [FOO-BAR-MIB::someTable.0] => Gauge32: 6
)