User Contributed Notes SNMP functions |
add a note |
rgroesb_garbage at triple-it_garbage dot nl
11-Mar-1999 02:39 |
|
<pre>
snmpset -- Set an SNMP object
int snmpset(string
hostname, string community, string object_id, string type, string
vallue);
The snmpset() function is used to set the value
of
an SNMP object.
The type should be a single character, one
of:
i INTEGER
s STRING
x HEX STRING
d
DECIMAL STRING
n NULLOBJ
o OBJID
t TIMETICKS
a IPADDRESS
Example:
snmpset("127.0.0.1",
"private","system.SysContact.0",
"s",
"Captain Iglo");
</pre>
Snmpset URL:
|
|
Thor2001 at gmx dot net
19-Mar-2000 05:27 |
|
in the <sourcedir php>/functions/snmp.c
add the line
#include <default_store.h>
before the first #include line.
|
|
jclark at NOSPAM dot xnet dot com
23-Mar-2000 02:20 |
|
Usually when PHP spits back a message referring to call undefined function,
it really means that the command you are attempting to use is not compiled
into PHP. To verify, use the phpinfo function.
|
|
bira at tech dot telepac dot pt
26-Apr-2000 03:41 |
|
Regarding to Gustavo's SNMP question.
I changed the code on
ext/snmp/snmp.c.
Heres how the snmp support compiles without
errors. Dont forget the --enable-ucd-snmp-hack:-)
look for the
following function (about line
360)
<pre>
PHP_FUNCTION(snmp_set_quick_print) {
/* jecete */
int set_val;
zval **a1;
if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &a1) == FAILURE)
{
WRONG_PARAM_COUNT;
}
convert_to_long_ex(a1);
/* jecete
Old
value commented
int set_val = (*a1)->value.lval; */
set_val = (*a1)->value.lval;
snmp_set_quick_print(set_val);
}
</pre>
|
|
zaid at mci dot net
01-Mar-2001 04:49 |
|
If you are trying to install the following on FreeBSD 4.2-RELEASE
#0:
apache_1.3.19
php-4.0.2
ucd-snmp-4.2
You will need to :
1- install the
ucd-snmp
a- rm libsnmp.so
b- ln libsnmp.a libsnmp.so
2-
make, and make install
3- follow the instructions in the INSTALL file
under PHP directory.
a- I used the following options to get
the
ability to make snmp calls within PHP :
./configure --with-mysql
--with-apache=../apache_1.3.19 --enable-track-vars --with-snmp=/usr/local
--enable-ucd-snmp-hack
|
|
beneti at ttl dot ktu dot lt
18-Jun-2001 12:06 |
|
Hey people!
Have you checked
?
There are more functions available (citation):
NOTE: The first
8 snmp_* functions are new and should be used. These obsolete the
"snmpget", "snmpwalk" and "snmpwalkoid".
General usage of these are: snmp_opensession(); snmp_get();
snmp_close();
Table of Contents
snmp_session � Opens an SNMP
session
snmp_close � Closes an SNMP session
snmp_get � Fetches
SNMP objects with an SNMP get request
snmp_getnext � Fetches SNMP
objects with an SNMP getnext request
snmp_getbulk � Fetches SNMP
objects with a SNMP getbulk request
snmp_walk � Fetches all SNMP
objects with the SNMP getnext request
snmp_bulkwalk � Fetches all
SNMP objects with the SNMP getbulk request
snmp_set � Sets the value
of SNMP objects with the SNMP set request
snmp_error � Fetches SNMP
protocol error of the last SNMP request.
snmpget � Fetch an SNMP
object
snmpwalk � Fetch all the SNMP objects from an agent
snmpwalkoid � Query for a tree of information about a network entity
snmp_get_quick_print � Fetch the current value of the UCD library's
quick_print setting
snmp_set_quick_print � Set the value of
quick_print within the UCD SNMP library
I've just checked
source code - at least it's free of bug of non-reading UCD library
configuration files (snmp.conf and etc.). I think it have to be still
adopted to php4.
And about this "bug":
if you want
for snmp module to read configuration files (snmp.conf) and return data in
described formats - not default ones, you have to change in source file
ext/snmp/snmp.c (php4-4.0.3) it should
be:
PHP_MINIT_FUNCTION(snmp)
{
init_snmp("snmp"); // instead of init_mib();
return SUCCESS;
}
Regards,
Vilius Benetis
LITNET
|
|
admin at Nospamplzkthx dot networkessence dot net
20-Aug-2001 05:54 |
|
If you are having problems getting snmp compiled with php, try these
steps:
compile snmp
[root ucd-snmp-4.2.1] ./configure
--with-openssl=/path/to/openssl-vers
[root ucd-snmp-4.2.1] make | make
install
then compile php
[root php-4.0.6] ./configure
--with-snmp=/usr/local --with-openssl --enable-ucd-snmp-hack
I
found that compiling ucd-snmp without openssl leaves out crypto, leaving
behind undefine symbol references, and if you specify a directory for
--with-openssl with php, it breaks the crypto library compilation.
|
|
bert at ncinter dot net
22-Aug-2001 04:10 |
|
The additional functions for SNMP for PHP v3 listed above I have converted
with the authors permission to work in version 4 of PHP.
Its
available from:
|
|
sbraab at yahoo dot com
15-Jan-2002 12:42 |
|
The new SNMP functions need to be modified to work properly with ucd 4.2.3
(and maybe others.) My symptom was that it looked like it wasn't read my
user defined MIBS. Your milage may vary.
I had to change all
read_objid() calls to snmp_parse_oid().
My diffs are a mess
othewise I would post them.
|
|
thug at wolf359 dot cjb dot net
22-Apr-2002 07:06 |
|
Just a quick note on PHP SNMP instalation on Windows machines (IIS 5.x /
Win2k SP2 etc...) I had installed PHP into C:\PHP.. (standard stuff
eh?)
Whilst I had followed the instructions for the installation of
SNMP (put php_snmp.dll in extension_dir, uncomment entry in php.ini and
all mib files located on the same drive where php was installed (in this
case c:\usr\mibs right?) I still ran into trouble like "Cannot find
module (IP-MIB): At line 0 in (none)..." appearing on the bottom of
every php that page I was viewing which existed on a drive other than C:\
drive...
It seams that the mibs dir (and content thereof) have to
be located on every volume where a php file will be executed
from.
For example :- If you have a php file as
"C:\INETPUB\WWWROOT\snmp1.php" then the coresponding
"C:\USR\MIBS\*.*" has to be present (as mentioned in the
install.txt).
Now here comes the catch...
If you have a
"D:\INETPUB\PHPROOT\snmp1.php" file, then a copy of the mib
files have to be in "D:\USR\MIBS\*.*" as well (the same mib
files that are on the C:\ drive and same basic location
<drive>:\USR\MIBS).
(Or in short : Copy the C:\USR dir (inc
mibs dir) to *every* drive you intend to have .php files accessed from.
Done!)
Hope this helps other PHParians.
Keep up the *Great*
work!!!
|
|
add a note |