Error using snmpset Please Help!
| From: | Lance O'Connor | Date: | Thu, 01 May 2003 16:57:49 +0000 |
| Subject: | Error using snmpset Please Help! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146001@lists.php.net to get a copy of this message | ||
I'm having a problem using snmpset() on Linux. I'm getting the
following error message: PHP Warning: snmpset()
[http://www.php.net/function.snmpset]: Could not add variable
All other snmp functions work just fine. I saw in the user contributed
documentation that this could be due to an invalid or unknown OID, or
if using a fully qualified numeric OID that it doesn't begin with a
".". However, as you can see below, I'm using a fully qualified
numeric OID that does begin with a "." and it's a vaild OID as I can
snmpget() it without any problems.
If anyone has any ideas I'd greatly appreciate it. I really need
snmpset for a project I'm working on.
Please also reply to postings@ronnoco.net
Regards,
Lance O'Connor
This is the code I'm using:
<?
$name = ".1.3.6.1.4.1.9.2.2.1.1.28.5";
$host = "10.100.230.14";
$comm = "123456789";
// Get the current port name
if(!$test = snmpget($host, $comm, $name))
{
echo "Error getting snmp info\n";
}
else
{
echo "Port Name: $test\n";
}
// Set the name to phptest
if(!snmpset($host, $comm, $name, "s", "phptest"))
{
echo "Error setting snmp info\n";
}
else
{
echo "Portname set\n";
}
?>
Syntax Check:
root@nutter:~/scratch# php -l snmp1.php
No syntax errors detected in snmp1.php
Output:
root@nutter:~/scratch# php snmp1.php
PHP Warning: snmpset() [http://www.php.net/function.snmpset]: Could
not add variable: in /root/scratch/snmp1.php on line 17
Port Name: STRING: "settest"
Error setting snmp info
Compiled in Modules:
root@nutter:~/scratch# php -m
[PHP Modules]
ctype
ftp
ldap
mysql
openssl
overload
pcre
pgsql
posix
session
snmp
standard
tokenizer
xml
yp
Version Information (from php -i)
PHP Version => 4.3.1
System => Linux nutter 2.4.20 #3 SMP Fri Feb 28 11:01:15 PST 2003 i686
Build Date => Apr 30 2003 14:35:28
Configure Command => './configure' '--with-apache=../apache_1.3.27'
'--with-mysql=/usr/local' '--
with-pgsql=/usr/local/pgsql' '--with-snmp' '--enable-ucd-snmp-hack'
'--with-ldap' '--with-openssl'
'--enable-yp' '--enable-ftp'
snmp
NET-SNMP Support => enabled
NET-SNMP Version => 5.0.7