note 57179 rejected from function.snmpget by nlopess

From: Date: Mon, 26 Sep 2005 18:41:27 +0000
Subject: note 57179 rejected from function.snmpget by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-95801@lists.php.net to get a copy of this message
Note Submitter: ---- <?php // author: dstjohn at mediacast1.com // modified from: bais at bais.info // updated: 09-26-2005 // set some vars //snmp community name $snmpcommunity = 'public'; //ips or dns to get snmp data from $ips = 'host1.test.com,host2.test.com,host3.test.com'; // oid description and location $oids= 'sysName.0, sysDescr.0, sysLocation.0, tcpCurrEstab.0, system.sysUpTime.0'; $oids_desc = 'System Name: ,System Description: ,System Location: ,Open TCP/IP Connections ,System Uptime Timetricks'; // easy method to create an array? $sysip = explode(",",$ips); $oid = explode(",",$oids); $oid_desc= explode(",",$oids_desc); //start da loop d loop for ($i = 0; $i <= count($sysip)-1; $i++) { echo "System IP:",$sysip[$i],"<br>\n"; $sysname[0] = snmpget($sysip[$i], $snmpcommunity, $oid[0]); if ($sysname[0] <> "") { for ($o = 1; $o <= count($oid)-1; $o++){ //get system name $sysname[0] = snmpget($sysip[$i], $snmpcommunity, $oid[$o]); $sysname[1] = eregi_replace("STRING:","",$sysname[0]); $sysname[1] = eregi_replace("INTEGER:","",$sysname[0]); echo $oid_desc[$o].$sysname[1]."<br>\n"; flush(); } //for echo "<br>\n"; } else { echo "NOT RESPONDING<br><br>\n"; } }//end loop ?> -------------------------- I need to write fastest method to understand if one host does not responding and if it have snmp service. regards Bais

« previous php.notes (#95801) next »