phpday 2027 - Call for Papers

SNMP::setOidOutputFormat

(PHP 8 >= 8.6.0)

SNMP::setOidOutputFormat — Set the OID output format of the session

Descrição

public function SNMP::setOidOutputFormat(Snmp\OidOutput $format): bool

Sets the format in which the OIDs returned by the requests of this session are printed, for instance in the keys of the array returned by SNMP::walk().

This is the same as setting the SNMP::$oid_output_format property to the corresponding SNMP_OID_OUTPUT_* constant. It does not change the format used by the other sessions, nor by functions such as snmp2_real_walk(); use snmp_set_oid_output_format() for those.

Parâmetros

format

The format to use. See Snmp\OidOutput for the available formats.

Valor Retornado

Sempre retorna true.

Exemplos

Exemplo #1 Walking with numeric OIDs

<?php

$session = new SNMP(SNMP::VERSION_2c, 'localhost', 'public');
$session->setOidOutputFormat(Snmp\OidOutput::Numeric);

var_dump($session->walk('IF-MIB::ifDescr'));

?>

O exemplo acima produzirá algo semelhante a:

array(2) {
  [".1.3.6.1.2.1.2.2.1.2.1"]=>
  string(10) "STRING: lo"
  [".1.3.6.1.2.1.2.2.1.2.2"]=>
  string(12) "STRING: eth0"
}

Veja também

+adicionar nota

Notas de Usuários

Não há notas de usuários para esta página.
To Top