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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.