SNMP::getFetch an SNMP object Beschreibung
public mixed SNMP::get
( mixed
$object_id
[, bool $preserve_keys = false
] )
Fetch an SNMP object specified in
Parameter-Liste
If
Rückgabewerte
Returns SNMP objects requested as string or array
depending on Fehler/Exceptions
This method do not throw any exceptions by default.
To enable throwing an SNMPException exception when some of library errors occure
user should set BeispieleBeispiel #1 Single SNMP object Single SNMP object may be requested in two ways: as string resulting string return value or as single-element array with associative array as output.
<?phpDas oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
STRING: Test server
Array
(
[SNMPv2-MIB::sysDescr.0] => STRING: Test server
)
Beispiel #2 Multiple SNMP objects
$session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
Array
(
[SNMPv2-MIB::sysDescr.0] => STRING: Test server
[SNMPv2-MIB::sysName.0] => STRING: myhost.nodomain
)
Siehe auch
|