Jump to content

PHP/SNMP Questions


johnny042

Recommended Posts

Hello everyone, first post on this forum.

 

I'm in the process of developing a web app to manage CPEs throughout a network using PHP and SNMP.  Two questions:

 

1. With SNMP, is it possible to communicate with a end-device aside from using a static hostname or IP address.

 

2. I am using NET SNMP to issue commands.  So far I haven't been successful in retrieving the correct data from my CPE.  Only the snmpwalk command has been able to retrieve data [only downside is I cannot specify an attribute so I receive a long list of parameters]

 

For example:

//get system name

$sysname = snmpget($host, $community, "system.sysName.0");

echo " Router Name: " . $sysname . "";

Warning: snmpget() [function.snmpget]: Invalid object identifier: system.sysName.0 in

^ will error out.  This same command issue via CLI will work properly.

 

//try snmpwalk

$swalk = snmpwalk($host, $community, "");

print "<h2>Stats for ". $host ."</h2>

SNMPWalk: <br /> " . $swalk . "<br>" ;

foreach ($swalk as $val) {print "$val</br>";}

^ my only solution so far, but then I get a really long list of data.

 

Any help is greatly appreciated.  Thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/168046-phpsnmp-questions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.