SNMP_SET_QUICK_PRINT(3) 1 SNMP_SET_QUICK_PRINT(3)snmp_set_quick_print - Set the value of$quick_printwithin the UCDSNMPlibrarySYNOPSIS
bool snmp_set_quick_print (bool $quick_print)
DESCRIPTION
Sets the value of $quick_print within the UCD SNMP library. When this is set (1), the SNMP library will return 'quick printed' values.
This means that just the value will be printed. When $quick_print is not enabled (default) the UCD SNMP library prints extra information
including the type of the value (i.e. IpAddress or OID). Additionally, if quick_print is not enabled, the library prints additional hex
values for all strings of three characters or less.
By default the UCD SNMP library returns verbose values, quick_print is used to return only the value.
Currently strings are still returned with extra quotes, this will be corrected in a later release.
PARAMETERS
o $quick_print
-
RETURN VALUES
No value is returned.
EXAMPLES
Setting quick_print is often used when using the information returned rather than displaying it.
Example #1
Using snmp_set_quick_print(3)
<?php
snmp_set_quick_print(0);
$a = snmpget("127.0.0.1", "public", ".1.3.6.1.2.1.2.2.1.9.1");
echo "$a
";
snmp_set_quick_print(1);
$a = snmpget("127.0.0.1", "public", ".1.3.6.1.2.1.2.2.1.9.1");
echo "$a
";
?>
The above example will output something similar to:
SEE ALSO snmp_get_quick_print(3).
PHP Documentation Group SNMP_SET_QUICK_PRINT(3)
Check Out this Related Man Page
SNMP_SET_VALUERETRIEVAL(3) 1 SNMP_SET_VALUERETRIEVAL(3)snmp_set_valueretrieval - Specify the method how the SNMP values will be returnedSYNOPSIS
bool snmp_set_valueretrieval (int $method = SNMP_VALUE_LIBRARY)
DESCRIPTION PARAMETERS
o $method
-
types
+-------------------+---------------------------------------------------+
|SNMP_VALUE_LIBRARY | |
| | |
| | The return values will be as returned by the Net- |
| | SNMP library. |
| | |
| SNMP_VALUE_PLAIN | |
| | |
| | The return values will be the plain value without |
| | the SNMP type hint. |
| | |
|SNMP_VALUE_OBJECT | |
| | |
| | The return values will be objects with the prop- |
| | erties "value" and "type", where the latter is |
| | one of the SNMP_OCTET_STR, SNMP_COUNTER etc. con- |
| | stants. The way "value" is returned is based on |
| | which one of constants SNMP_VALUE_LIBRARY, |
| | SNMP_VALUE_PLAIN is set. |
| | |
+-------------------+---------------------------------------------------+
EXAMPLES
Example #1
Using snmp_set_valueretrieval(3)
<?php
snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// $ret = "STRING: lo"
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// $ret = "lo";
snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => lo
// )
// PHP 5.4+ examples
snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => lo
// )
snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_LIBRARY);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => STRING: lo
// )
?>
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.4.0 | |
| | |
| | Constants SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY |
| | may be combined with SNMP_VALUE_OBJECT resulting |
| | different way of representing contents of $value |
| | array element in return value of GET-function. If |
| | no SNMP_VALUE_{PLAIN,LIBRARY} constant is accom- |
| | panying SNMP_VALUE_OBJECT, SNMP_VALUE_LIBRARY is |
| | used. Prior to 5.4.0 SNMP_VALUE_OBJECT effe- |
| | cively meant SNMP_VALUE_OBJECT| SNMP_VALUE_PLAIN. |
| | |
+--------+---------------------------------------------------+
SEE ALSO snmp_get_valueretrieval(3), "Predefined Constants".
PHP Documentation Group SNMP_SET_VALUERETRIEVAL(3)