CakeFest 2024: The Official CakePHP Conference

snmp_set_enum_print

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

snmp_set_enum_print すべての enum を、実際の整数値ではなく enum 値とともに返す

説明

snmp_set_enum_print(bool $enable): true

この関数は、snmpwalk/snmpget などが自動的に MIB の enum 値を探して可読形式の文字列で返すかどうかを切り替えます。

パラメータ

enable

この値は boolean として Net-SNMP ライブラリが解釈します。"0" あるいは "1" しか指定できません。

戻り値

常に true を返します。

変更履歴

バージョン 説明
8.2.0 戻り値の型が、true になりました。これより前のバージョンでは、bool でした。

例1 snmp_set_enum_print() の使用法

<?php
snmp_set_enum_print
(0);
echo
snmpget('localhost', 'public', 'IF-MIB::ifOperStatus.3') . "\n";
snmp_set_enum_print(1);
echo
snmpget('localhost', 'public', 'IF-MIB::ifOperStatus.3') . "\n";
?>

上の例の結果は次のようになります。

INTEGER: up(1)
 INTEGER: 1

add a note

User Contributed Notes 1 note

up
0
dbeecher at tekops dot com
19 years ago
This function is only available if using NET_SNMP. It is NOT available if using UCD_SNMP. Likewise UCD_SNMP supports some behaviors that NET_SNMP does not. (found limitation by looking in php snmp.c file)
To Top