SNMP Functions
介紹
需求
In order to use the SNMP functions on Unix you need to install the » NET-SNMP package. On Windows these functions are only available on NT and not on Win95/98.
安裝
Important: In order to use the UCD SNMP package, you need to define NO_ZEROLENGTH_COMMUNITY to 1 before compiling it. After configuring UCD SNMP, edit config.h or acconfig.h and search for NO_ZEROLENGTH_COMMUNITY. Uncomment the #define line. It should look like this afterwards:
#define NO_ZEROLENGTH_COMMUNITY 1
If you see strange segmentation faults in combination with SNMP commands, you did not follow the above instructions. If you do not want to recompile UCD SNMP, you can compile PHP with the --enable-ucd-snmp-hack switch which will work around the misfeature.
The Windows distribution contains support files for SNMP in the mibs directory. This directory should be moved to DRIVE:\usr\mibs, where DRIVE must be replaced with the driveletter where PHP is installed on, e.g.c:\usr\mibs.
執行時期組態
php.ini中沒有定義此延伸的組態指令。
資源類型
預先定義常數
以下的常數由此延伸定義,只在這個延伸被編譯成PHP或實行時期被動態載入時有效。
- SNMP_OID_OUTPUT_FULL (integer)
- As of 5.2.0
- SNMP_OID_OUTPUT_NUMERIC (integer)
- As of 5.2.0
- SNMP_VALUE_LIBRARY (integer)
- SNMP_VALUE_PLAIN (integer)
- SNMP_VALUE_OBJECT (integer)
- SNMP_BIT_STR (integer)
- SNMP_OCTET_STR (integer)
- SNMP_OPAQUE (integer)
- SNMP_NULL (integer)
- SNMP_OBJECT_ID (integer)
- SNMP_IPADDRESS (integer)
- SNMP_COUNTER (integer)
- SNMP_UNSIGNED (integer)
- SNMP_TIMETICKS (integer)
- SNMP_UINTEGER (integer)
- SNMP_INTEGER (integer)
- SNMP_COUNTER64 (integer)
Table of Contents
- snmp_get_quick_print — Fetches the current value of the UCD library's quick_print setting
- snmp_get_valueretrieval — Return the method how the SNMP values will be returned
- snmp_read_mib — Reads and parses a MIB file into the active MIB tree
- snmp_set_enum_print — Return all values that are enums with their enum value instead of the raw integer
- snmp_set_oid_numeric_print — Return all objects including their respective object id within the specified one
- snmp_set_oid_output_format — Set the OID output format
- snmp_set_quick_print — Set the value of quick_print within the UCD SNMP library
- snmp_set_valueretrieval — Specify the method how the SNMP values will be returned
- snmpget — Fetch an SNMP object
- snmpgetnext — Fetch a SNMP object
- snmprealwalk — Return all objects including their respective object ID within the specified one
- snmpset — Set an SNMP object
- snmpwalk — Fetch all the SNMP objects from an agent
- snmpwalkoid — Query for a tree of information about a network entity