Index of /yeast/cluster/database/php-3.0.14/dl/snmp
Name Last modified Size Description
Parent Directory 13-Jan-2000 08:18 -
README 02-Nov-1997 17:58 1k
php3_snmp.h 29-Apr-1998 09:23 2k
snmp.c 16-Jun-1999 07:34 8k
winsnmp.c 28-Dec-1998 04:34 7k
PHP3 UCD-SNMP Extension
What is it?
This is an extension library which ties the ucd-snmp library to
PHP3. Only snmpget and snmpwalk are supported at this time. If
you need other functions, feel free to add them and send me a
patch. (rasmus@lerdorf.on.ca)
Installation
You first need to get a hold of ucd-snmp-3.2. This extension
hasn't been tested with any other version.
Compile and install it. Make sure the following header files from
the ucd-3.2/snmplib directory get copied to /usr/local/include,
or wherever dl/Makefile tries to include files from.
asn1.h, snmp_api.h, snmp_client.h, snmp_impl.h, snmp.h, parse.h
Then type: make snmp.so
from the php3/dl directory.
If there is no Makefile, run ./setup
You may also need to add some -I<path> statements to the CC line.
How to call it from PHP3
On the page where you need to make an SNMP call, load the library:
<? dl("<path>/snmp.so"); ?>
To fetch an object:
<? $value = snmpget("hostname","community","object_id"); ?>
For example: snmpget("127.0.0.0","public","system.sysContact.0")
The arguments to snmpwalk() are identical. The difference being that the
returned value is an array of snmp objects. You can step through them
with a loop.
For example: $a = snmpwalk("127.0.0.0","public","");
for($i=0;$i<count($a);$i++) {
echo $a[$i];
}