Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/ap/snmp_default.php
<?php
if ($comunity!="") {
echo '<tr><td colspan=2><big style="font-family: Aircut"><span
	 style="font-weight: bold; text-decoration: italic;">';
	 echo "Useful NAS information :</big></td></tr><br><br>";

echo '
<table style="text-align: left; width: 618px;" border="1"
	cellpadding="2" cellspacing="2">
	<tbody>
		<tr>
	<td style="width: 196px;"><small><b>System Name</td>';
	 snmp_set_valueretrieval(0);
	 $sys = snmpget($hostname,$comunity,"sysName.0");
	 snmp_set_valueretrieval(1);
	 echo '<td style="width: 404px;"><small>'. str_replace('STRING: ',"",$sys).'</small></td>';
	 
	 echo'	</tr>
		<tr>
		<td style="width: 196px;"><small><b>System Description</td>';
	 snmp_set_valueretrieval(0);
	 $sys = snmpget($hostname,$comunity,"sysDescr.0");
	 snmp_set_valueretrieval(1);

	 echo '<td style="width: 404px;"><small>'. str_replace('STRING: ',"",$sys).'</small></td>';
	 echo'
		</tr>
		<tr>
			<td style="width: 196px;"><small><b>Location</td>';
	 snmp_set_valueretrieval(0);
	 $sys = snmpget($hostname,$comunity,"sysLocation.0");
	 snmp_set_valueretrieval(1);

	 echo '<td style="width: 404px;"><small>'. str_replace('STRING: ',"",$sys).'</small></td>';
		echo '</tr>
		<tr>
			<td style="width: 196px;"><small><b>Uptime</td>';
	 snmp_set_valueretrieval(0);
	 $sys = snmpget($hostname,$comunity,"sysUpTimeInstance");
	 snmp_set_valueretrieval(1);

	 echo '<td style="width: 404px;"><small>'. str_replace('Timeticks: ',"",$sys).'</small></td>';
	
		echo '</tr>
																	 </tbody>
																 </table>
																 <br>';
	 
	 snmp_set_valueretrieval(0);
	 $nbi = snmpget($hostname,$comunity,"ifNumber.0");
	 $nbi=str_replace('INTEGER: ',"",$nbi);
	 snmp_set_valueretrieval(1);
	 echo '<tr><td colspan=2><big style="font-family: Aircut"><span
	 style="font-weight: bold; text-decoration: italic;">';
	 echo "NAS interfaces :</big></td></tr><br>";

																 echo '<br>
																 <table style="text-align: left; width: 100%;" border="1"
																  cellpadding="2" cellspacing="2">
																  <tbody>
																		<tr>
																			<td style="width: 100px;"><small><small><b>Name</b></small></small></td>
																			<td style="width: 49px;"><small><small><b>Type</small></small></td>
																			<td style="width: 157px;"><small><small><b>Mac&nbsp;address</small></small></td>
																			<td style="width: 100px;"><small><small><b>ip address</small></small></td>
																			<td style="width: 100px;"><small><small><b>netmask</small></small></td>
																			<td style="width: 78px;"><small><small><b>Octets ouput</small></small></td>
																			<td style="width: 78px;"><small><small><b>Octets input</small></small></td>
																			<td style="width: 37px;"><small><small><b>Status</small></small></td>
																			</tr>';
	 
	 for ($i=1;$i<=$nbi;$i++)
	 {
                 snmp_set_valueretrieval(0);
                 $idxi = snmpwalk($hostname,$comunity,"ifIndex");
		 snmp_set_valueretrieval(1);
		 $idx=str_replace('INTEGER: ',"",$idxi[$i-1]);

	echo '
		<tr>
		<td style="width: 100px;"><small><small>';

                 snmp_set_valueretrieval(0);
                 $name = snmpwalk($hostname,$comunity,"ifDescr");
                 $type = snmpwalk($hostname,$comunity,"ifType");
                 $mac = snmpwalk($hostname,$comunity,"ifPhysAddress");
                 $ipaddri = snmpwalk($hostname,$comunity,"ipAdEntIfIndex");
                 $ipaddr = snmpwalk($hostname,$comunity,"ipAdEntAddr");
                 $netmask = snmpwalk($hostname,$comunity,"ipAdEntNetMask");
                 $oout = snmpwalk($hostname,$comunity,"ifOutOctets");
                 $oin = snmpwalk($hostname,$comunity,"ifInOctets");
                 $stat = snmpwalk($hostname,$comunity,"ifOperStatus");
		 snmp_set_valueretrieval(1);
		 echo  str_replace('STRING: ',"",$name[$idx-1]).'</small></small></td>';
		
		 echo '<td ><small><small>';
		 echo str_replace('INTEGER: ',"",$type[$idx-1]).'</small></small></td>';
		 echo '<td ><small><small>';
		
		 echo str_replace('STRING: ',"",$mac[$idx-1]).'</small></small></td>';
		 $find='False';
		 $ind=0;
		 foreach ($ipaddri as $val) 
		 {
			 if ( str_replace('INTEGER: ',"",$val)==$idx)
			 {
				 $find='True';
				 break;
			 }
			 $ind++;

		 }
		 
		 if ($find=='True') {
		 echo '<td ><small><small>';
		 echo str_replace('IpAddress: ',"",$ipaddr[$ind]).'</small></small></td>';
		 echo '<td ><small><small>';
		 echo str_replace('IpAddress: ',"",$netmask[$ind]).'</small></small></td>';
		 }
		 else 
		 {
		 echo '<td ><small><small>';
		 echo '</small></small></td>';
		 echo '<td ><small><small>';
		 echo '</small></small></td>';

		 }
		 echo '<td ><small><small>';
	        echo octets2str(str_replace('Counter32: ',"",$oout[$idx-1])).'</small></small></td>';
		 echo '<td ><small><small>';
	        echo octets2str(str_replace('Counter32: ',"",$oin[$idx-1])).'</small></small></td>';
		 echo '<td ><small><small>';
	        echo str_replace('INTEGER: ',"",$stat[$idx-1]).'</small></small></td>';
	echo'	</tr>';
	 }
	echo '
		</tbody>
		</table>';
	}
	else echo "<p class=\"information\"> You should setup correctly snmp, in ap configuration module.</p>";
?>
Return current item: phpMyPrepaid