Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

snmp_set_valueretrieval

Description

The snmp_set_valueretrieval of SNMP for PHP specifies the method for how the SNMP values will be returned.

Syntax

snmp_set_valueretrieval(
    int $method
): true

Parameters

method

ConstantDescription
SNMP_VALUE_LIBRARYThe return values will be as returned by the Net-SNMP library.
SNMP_VALUE_PLAINThe return values will be the plain value without the SNMP type information.
SNMP_VALUE_OBJECTThe return values will be objects with the properties value and type, where the latter is one of the SNMP_OCTET_STR, SNMP_COUNTER etc. constants. The way value is returned is based on which one of constants SNMP_VALUE_LIBRARY, SNMP_VALUE_PLAIN is set.

Return

Always returns true.

Examples

1 · method · SNMP_VALUE_LIBRARY

<?

$method = SNMP_VALUE_LIBRARY;

$return = snmp_set_valueretrieval($method);

var_export($return);

?>
true

2 · method · SNMP_VALUE_PLAIN

<?

$method = SNMP_VALUE_PLAIN;

$return = snmp_set_valueretrieval($method);

var_export($return);

?>
true

3 · method · SNMP_VALUE_OBJECT

<?

$method = SNMP_VALUE_OBJECT;

$return = snmp_set_valueretrieval($method);

var_export($return);

?>
true

4 · snmpget · SNMP_VALUE_LIBRARY

<?

$method = SNMP_VALUE_LIBRARY;

snmp_set_valueretrieval($method);

$hostname = "localhost";
$community = "public";
$object_id = "IF-MIB::ifName.1";

$return = snmpget($hostname, $community, $object_id);

var_dump($return);

?>

5 · snmpget · SNMP_VALUE_PLAIN

<?

$method = SNMP_VALUE_PLAIN;

snmp_set_valueretrieval($method);

$hostname = "localhost";
$community = "public";
$object_id = "IF-MIB::ifName.1";

$return = snmpget($hostname, $community, $object_id);

var_dump($return);

?>

6 · snmpget · SNMP_VALUE_OBJECT

<?

$method = SNMP_VALUE_OBJECT;

snmp_set_valueretrieval($method);

$hostname = "localhost";
$community = "public";
$object_id = "IF-MIB::ifName.1";

$return = snmpget($hostname, $community, $object_id);

var_dump($return);

?>
HomeMenu