phpday 2027 - Call for Papers

snmp_init_mib

(PHP 8 >= 8.6.0)

snmp_init_mib — Reset the MIB tree

Descrizione

function snmp_init_mib(?string $mibdirs): void

Unloads the whole MIB tree of the Net-SNMP library, including the MIB files read with snmp_read_mib(), sets the list of directories in which MIB files are searched, and then loads the MIB tree again.

When the tree is loaded again, the MIB modules listed in the MIBS environment variable, or else the default modules, are read from these directories, as well as the files listed in the MIBFILES environment variable. The MIB directories are also searched when an OID such as IF-MIB::ifDescr names a module that is not loaded yet.

This is useful to load a different set of MIB modules, for instance when two vendor MIBs define conflicting objects for the same OID.

At the end of the request, the default MIB directories and tree are restored.

Elenco dei parametri

mibdirs

The directories in which MIB files are searched, separated by a colon (:), or by a semicolon (;) on Windows.

If null, the directories are taken from the MIBDIRS environment variable, from the mibdirs token of the Net-SNMP configuration file, or are the default directories of the Net-SNMP library, in that order.

Valori restituiti

Nessun valore viene restituito.

Esempi

Example #1 Loading MIB files from other directories

<?php

// Search for MIB files in these directories only
snmp_init_mib('/opt/vendor/mibs:/usr/share/snmp/mibs');
$descriptions = snmp2_real_walk('localhost', 'public', 'VENDOR-MIB::vendorDescr');

?>

Vedere anche:

+add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top