Folus Wen dd8509b6b1 [Add][GPL][php] 2 years ago
..
CONFLICTS dd8509b6b1 [Add][GPL][php] 2 years ago
README.md dd8509b6b1 [Add][GPL][php] 2 years ago
bigtest dd8509b6b1 [Add][GPL][php] 2 years ago
bug60749.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
bug64124.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
bug64159.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
bug72479.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
clean.inc dd8509b6b1 [Add][GPL][php] 2 years ago
generic_timeout_error.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
ipv6.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
skipif.inc dd8509b6b1 [Add][GPL][php] 2 years ago
snmp-object-errno-errstr.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp-object-error.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp-object-properties-error.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp-object-properties.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp-object-setSecurity_error.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp-object.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp2_get.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp2_getnext.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp2_real_walk.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp2_set-nomib.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp2_set.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp2_walk.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp3-error.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp3.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp_get_quick_print.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp_get_valueretrieval.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp_getvalue.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp_include.inc dd8509b6b1 [Add][GPL][php] 2 years ago
snmp_read_mib.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp_set_enum_print.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmp_set_oid_output_format.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmpd.conf dd8509b6b1 [Add][GPL][php] 2 years ago
snmpget.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmpgetnext.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmprealwalk.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmpset-nomib.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmpset.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
snmpwalk.phpt dd8509b6b1 [Add][GPL][php] 2 years ago
wrong_hostname.phpt dd8509b6b1 [Add][GPL][php] 2 years ago

README.md

The snmp extension tests

To enable these tests, you must have:

  • PHP compiled with SNMP --with-snmp
  • An SNMP server running.

How to test

You need to give credentials with environment vars if default ones are not suitable (see snmp_include.inc for more info):

SNMP_HOSTNAME : IPv4 of remote SNMP agent
SNMP_HOSTNAME : IPv6 or remote SNMP agent
SNMP_PORT : SNMP port for queries
SNMP_COMMUNITY : community name
SNMP_COMMUNITY_WRITE : community used for write tests (snmpset()).
SNMP_MIBDIR : Directory containing MIBS

To run test suite you may use this command (presuming that you pwd is where this README file is located):

make -C ../../.. test TESTS="`cd ../../..; /bin/ls -1 ext/snmp/tests/*.phpt | xargs echo`"

Running run-tests.php directly will clear your environment and therefore tests will fail if your SNMP configuration does not fit into default values specified in snmp_include.inc.

Configuring the SNMPD server

On Linux/FreeBSD

  • On Ubuntu, install snmpd and snmp-mibs-downloader. (May be net-snmpd on other distributions.)
  • Replace config file (by default this is /etc/snmp/snmpd.conf on Linux and /usr/local/etc/snmp/snmpd.conf on FreeBSD) with snmpd.conf supplied.

Before launching daemon make sure that there is no file /var/net-snmp/snmpd.conf. Delete it if exists. Forgetting to do so will fail SNMPv3 tests.

  • Place ext/snmp/tests/bigtest near snmpd.conf, tune path to it in snmpd.conf.
  • Launch snmpd (service snmpd start or /etc/init.d/snmpd start). Alternatively you can start snmpd daemon using following command line:

    sudo snmpd -C -c ./snmpd.conf -f -Le