Interface logic fixed // 02/09/04 v0.4 - Fixed display when > 1 IPaddr on an intferace // 02/10/04 v0.5 - Converted to all numberic OIDs (RH9 likes them) // ////////////////////////////////////////////////////////////////////// // User defind VARs $communities = array ("public","mycommunitystring2"); // 1st = default $snmptimeout = 500000; // For initial check 1000000 = 1 second // Shouldn't have to set anything below here error_reporting(0); snmp_set_quick_print(1); if ($_REQUEST['community'] == "") { $community = $communities[0]; } else { $community = $_REQUEST['community']; } if (! $_REQUEST['host'] == "") { $host = $_REQUEST['host']; } function syssrv($sv) { if ($sv & 1) {$srv = " Repeater"; } if ($sv & 2) {$srv = "$srv Bridge"; } if ($sv & 4) {$srv = "$srv Router"; } if ($sv & 8) {$srv = "$srv Gateway"; } if ($sv & 16) {$srv = "$srv Session"; } if ($sv & 32) {$srv = "$srv Terminal"; } if ($sv & 64) {$srv = "$srv Application"; } if (!$sv) {$srv = "SNMP services not supported"; } return $srv; } ?> SNMP Interface information

SNMP Interface Information

Could not query $host!\n"; echo "\n\n\n"; exit; } } $sysName = snmpget("$host","$community",".1.3.6.1.2.1.1.5.0"); $sysUpTime = snmpget("$host","$community",".1.3.6.1.2.1.1.3.0"); // Get Uptime in nice format sscanf($sysUpTime, "%d:%d:%d:%d.%d",$day,$hour,$minute,$sec,$ticks); if ($day == 1) { $daystr = "day"; } else { $daystr = "days"; } if ($hour == 1) { $hourstr = "hour"; } else { $hourstr = "hours"; } if ($minute == 1) { $minutestr = "minute"; } else { $minutestr = "minutes"; } if ($sec == 1) { $secstr = "second"; } else { $secstr = "seconds"; } $sysUpTime = "$day $daystr $hour $hourstr $minute $minutestr and $sec $secstr"; $ifDescr = snmpwalk("$host","$community",".1.3.6.1.2.1.2.2.1.2"); $ifIndex = snmpwalk("$host","$community",".1.3.6.1.2.1.2.2.1.1"); $ifAdminStatus = snmpwalk("$host","$community",".1.3.6.1.2.1.2.2.1.7"); $ifOperStatus = snmpwalk("$host","$community",".1.3.6.1.2.1.2.2.1.8"); $ifLastChange = snmpwalk("$host","$community",".1.3.6.1.2.1.2.2.1.9"); $ifiporder = snmpwalk("$host","$community",".1.3.6.1.2.1.4.20.1.2"); $ifip = snmpwalk("$host","$community",".1.3.6.1.2.1.4.20.1.1"); $ifmac = snmpwalk("$host","$community",".1.3.6.1.2.1.2.2.1.6"); $sv = snmpget("$host","$community",".1.3.6.1.2.1.1.7.0"); $srv = syssrv($sv); ?>

SNMP Interface Information

Host:
Community:
"; print ""; print ""; print ""; if ($ifmac[$i]) { $m1=$m2=$m3=$m4=$m5=$m6=0; list($m1,$m2,$m3,$m4,$m5,$m6) = split(":",$ifmac[$i]); printf("",hexdec($m1),hexdec($m2),hexdec($m3),hexdec($m4),hexdec($m5),hexdec($m6)); } else { printf(""); } $ips=""; for ($x=0; $x" . $ifip[$x]; } else { $ips = $ifip[$x]; } } } if ($ips) { print ""; } else { print ""; } print "\n"; } ?>
SNMP
Name
Description
Services
snmp UpTime
Interfaces
DescrAdmOprMACIPaddr
" . (($ifDescr[$i])?$ifDescr[$i]:' ') . "" . (($ifAdminStatus[$i])?$ifAdminStatus[$i]:' ') . "" . (($ifOperStatus[$i])?$ifOperStatus[$i]:' ') . "%02X %02X %02X %02X %02X %02X $ips 
Host: Community (opt):