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

I am looking for *any* SNMP object on the network, basically I want it to create a device list of clients / PC's on my network.. So I am unsure how to set such a number, especially when it looks as if it will be quite specific..?

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

  • 2 weeks later...
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.