Re: PLEASE HELP!!! snmp question

From: Date: Fri, 29 Sep 2000 10:05:13 +0000
Subject: Re: PLEASE HELP!!! snmp question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18028@lists.php.net to get a copy of this message
Sonia, Arrgh. I have been waiting for a question on SNMP since leaving my last job where loads of the stuff. Simple... Ha! > When I did > % snmpget localhost public system.sysDescr.0 > I got: > Timeout: No Response from localhost. This either means that the localhost dose not support SNMP or you have asked and SNMP question which the target machine dose not know the answer to ( the default option in this case is to drop the packet ie not reply) Try snmpget -v 1<hostname> <communtiy_name> <oid> eg snmpget -v 1 localhost public system.sysDescr.0 or snmpget -v 1 localhost public .1.3.6.1.2.1.1.1.0 which is the easier to remember version. The SNMP uses libsnmp.a which must be compiled into the PHP so when you do your configure add: --with-snmp=[DIR] --enable-ucd-snmp-hack where DIR is the base dir of the snmp. Then compile as usual. > my $sess = new SNMP::Session ( DestHost => $host, Community => $comm, >bRemotePort => $port ); > my $vars = new SNMP::VarList([USER],[SYSTEM],[INFO]); > for (@vals = $sess->getnext($vars); ...) { > print("vals[0] vals[1] vals[2]"); > } Try: $a = snmpwalk("127.0.0.1", "public", ""); for ($i=0; $i<count($a); $i++) { echo $a[$i]; } You'll have to play with it because I don't have it compile and the moment. I copied this from the maual page! Thank you for letting me stretch my SNMP legs! Hope this is of some help! David.

« previous php.general (#18028) next »