PHP and SNMP V2c

"Jeff Boettger" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Good Morning/Afternoon,
 
I've been working on creating a small php page that grabs a few stats off of switches we have here at work.
 
>From the command line: "snmpget -v 2c -c private 10.1.1.1 .1.3.6.1.2.1.1.6.0" returns the appropriate value, which proves that the device is up and snmp works.
 
The problem is when I try to do php and pull a v2c device (I've been able to pull devices using v1, but this particular device is v2c only).
 
I am currently running net-snmp v5.1.2 and have posted my test code below. (version 1 and version 3 return that they are working, but not version 2c)
 
Thanks,
JJ
 
<?php
 
   $int_ip_address = "10.1.1.1";
   $str_community_string = "private ( mailto:B0@t1a )";
   $str_oid = ".1.3.6.1.2.1.1.6.0";
 
   $str_snmpget_result = snmpget($int_ip_address,$str_community_string,$str_oid,1000000,4);
 

   if ($str_snmpget_result==False){
    echo "IP Unreachable: ".$int_ip_address."\n";
   }
 

   if ($str_snmpget_result!=False){
    echo $str_snmpget_result."\n";
   }
 
   if (function_exists("snmpget")){
    echo "Version 1 Works.\n";
   }
 
   if (function_exists("snmp2_get")){
    echo "Version 2c Works.\n";
   }
 

   if (function_exists("snmp3_get")){
    echo "Version 3 Works.\n";
   }
 
echo $str_snmpget_result."\n";
 
echo "\n\n";
 

?>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.