Jump to content

snmpget()


trp

Recommended Posts

Hi there,

I am trying to write a simple network management website that allows me to see what is on my network and interact with it, I am hoping to use the 'snmpget()' function to 'grab' all the devices in a subnet.

 

Here is the code I have so far:

	$current_ip = "192.168.0.10";

	$scan = snmpget($current_ip, "public", "system.SysContact.0");
	echo $scan;

 

I *think* that should work, it, however just breaks the page on which it sits  :(

 

Can anyone give me any insights as to what I may be doing wrong, or how I can use SNMP & PHP to discover devices on my network?

 

Many Thanks (in advance!)

 

TRP

Link to comment
https://forums.phpfreaks.com/topic/195311-snmpget/
Share on other sites

Hi there,

I am trying to write a simple network management website that allows me to see what is on my network and interact with it, I am hoping to use the 'snmpget()' function to 'grab' all the devices in a subnet.

 

Here is the code I have so far:

	$current_ip = "192.168.0.10";

	$scan = snmpget($current_ip, "public", "system.SysContact.0");
	echo $scan;

 

I *think* that should work, it, however just breaks the page on which it sits  :(

 

Can anyone give me any insights as to what I may be doing wrong, or how I can use SNMP & PHP to discover devices on my network?

 

Many Thanks (in advance!)

 

TRP

 

Using windows?

Link to comment
https://forums.phpfreaks.com/topic/195311-snmpget/#findComment-1026343
Share on other sites

OK, that at least means the page doesn't just "break" stupid oversight!

I still get no useful information back, it takes a few seconds to load the page (I assume while it does the snmpget operation) but does not echo anything back, I am trying different MIBS etc but if anyone can see an obvious hole in what I am doing / would be able to take a closer look with me, that would be great.

 

Thanks for your help so far :)

Link to comment
https://forums.phpfreaks.com/topic/195311-snmpget/#findComment-1027529
Share on other sites

  • 3 weeks later...

Hey guys,

Time to start this one up again, having had some time off I am now back on working on this.

 

Current code is as follows:

$current_ip = "192.168.1.1";
$scan = snmpget($current_ip, "public", "1.3.6.1.2.1.2.2.1.7");
echo $scan;

 

This is a valid IP on the network (it's a Linksys Wireless N router) and I have tried it with others.

The MIB is extracted from the following website - MRTG: http://oss.oetiker.ch/mrtg/doc/mrtg-mibhelp.en.html

Descriptor: ifAdminStatus

Identifier: 1.3.6.1.2.1.2.2.1.7

ASN.1 Syntax: INTEGER

Enumeration: up 1, down 2, testing 3

 

There is simply no output from the function, what am I doing wrong here? I am pulling my hair out!

Link to comment
https://forums.phpfreaks.com/topic/195311-snmpget/#findComment-1035299
Share on other sites

  • 2 weeks later...

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.