trp Posted March 15, 2010 Share Posted March 15, 2010 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 Quote Link to comment Share on other sites More sharing options...
aeroswat Posted March 15, 2010 Share Posted March 15, 2010 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? Quote Link to comment Share on other sites More sharing options...
trp Posted March 15, 2010 Author Share Posted March 15, 2010 Yes, Windows Server 2003 with Apache 2.2, PHP & MySQL, sorry for not including that in the first post. TRP Quote Link to comment Share on other sites More sharing options...
aeroswat Posted March 15, 2010 Share Posted March 15, 2010 From what I'm reading you can't use sysObjectID.0 in Windows versions. Apparently you have to use numeric id's. It recommends to google "cisco snmp object navigator" Quote Link to comment Share on other sites More sharing options...
trp Posted March 15, 2010 Author Share Posted March 15, 2010 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..? Quote Link to comment Share on other sites More sharing options...
trp Posted March 16, 2010 Author Share Posted March 16, 2010 bump. Anyone got any idea's how I can pull this off? Even just to get some useful output would be good.. currently, even when running it with a MIB it just 'breaks' the rest of the page.. Quote Link to comment Share on other sites More sharing options...
trp Posted March 16, 2010 Author Share Posted March 16, 2010 Just noticed that there is no mention of SNMP in the phpinfo file.. should there be if it is all working correctly? As there isn't, what do I need to do? Quote Link to comment Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Share Posted March 16, 2010 http://bugs.php.net/45883 if it doesn't show up then it shouldn't even recognize the functions as being defined. Quote Link to comment Share on other sites More sharing options...
trp Posted March 16, 2010 Author Share Posted March 16, 2010 Ok then, maybe a stupid problem, how do I run something like "./configure --with-snmp" when compiling PHP as it is already compiled and running.. ? Quote Link to comment Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Share Posted March 16, 2010 Ok then, maybe a stupid problem, how do I run something like "./configure --with-snmp" when compiling PHP as it is already compiled and running.. ? recompile source? Quote Link to comment Share on other sites More sharing options...
trp Posted March 17, 2010 Author Share Posted March 17, 2010 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 Quote Link to comment Share on other sites More sharing options...
trp Posted April 1, 2010 Author Share Posted April 1, 2010 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! Quote Link to comment Share on other sites More sharing options...
trp Posted April 12, 2010 Author Share Posted April 12, 2010 *bump* Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.