--- tools/tools.php	Tue Jul 25 10:37:43 2006
+++ ../cacti/plugins/tools/tools.php	Wed Aug  1 14:28:38 2007
@@ -18,6 +18,21 @@
 else
 	$host = '127.0.0.1';
 
+if (isset($_POST['oid']))
+                $oid = $_POST['oid'];
+        else
+                $oid = ".1";
+        if (isset($_POST['community']))
+                $community = $_POST['community'];
+        else
+                $community = "public";
+
+        if (isset($_POST['port']))
+                $port = $_POST['port'];
+        else
+                $port=161;
+
+
 include_once("./include/top_header.php");
 
 show_tools ();
@@ -43,7 +58,7 @@
 
 
 function show_tools () {
-	global $action, $host;
+	global $action, $host, $oid, $community, $port;
 	print "<br><br><br><center><table width=500 bgcolor=black cellpadding=1 cellspacing=0><tr><td><table width='100%' bgcolor=white cellspacing=3><tr><td>";
 	print "<form method=POST action=tools.php>";
 	print "<table width='100%'><tr><td valign=center width=50>Host</td><td valign=center>";
@@ -54,8 +69,9 @@
 	if ($action == 'snmpwalk')
 		print " checked";
 	print "></td><td><h3>SNMP Walk</h3>";
-	print "<table cellspacing=0 cellpadding=0 corder=0><tr><td>OID</td><td><input type=text size=20 value='.1' name=oid id=oid></td></tr>";
-	print "<tr><td>Community&nbsp;&nbsp;&nbsp;</td><td><input type=text size=20 value='public' name=community id=community></td></tr></table>";
+       print "<table cellspacing=0 cellpadding=0 corder=0><tr><td>OID</td><td><input type=text size=20 value='".$oid."' name=oid id=oid></td></tr>";
+       print "<tr><td>Community&nbsp;&nbsp;&nbsp;</td><td><input type=text size=20 value='".$community."' name=community id=community></td></tr>";
+       print "<tr><td>Port</td><td><input type=text size=5 value='".$port."' name=port id=port></td></tr></table>";
 	print "</td><tr>";
 	print "<tr><td colspan=2><hr width='100%'></td></tr>";
 
@@ -114,13 +130,18 @@
 	else
 		$community = "public";
 
+       if (isset($_POST['port']))
+               $port = $_POST['port'];
+       else
+               $port=161;
+
 	$host = strtolower($host);
 	snmp_set_quick_print(0);
 
-	$a = cacti_snmp_walk($host, $community, $oid, 2, "", "", 161, 1000);
+	$a = cacti_snmp_walk($host, $community, $oid, 2, "", "", $port, 1000);
 	print "<br><br><br><center><table bgcolor=black cellpadding=1 cellspacing=0><tr><td><table width='100%' bgcolor=white><tr><td>";
 
-	print "<center><table border=1px><tr><td colspan=2 bgcolor=white><center><h3>SNMP Walk Results for $host</h3></center></td></tr>";
+	print "<center><table border=1px><tr><td colspan=2 bgcolor=white><center><h3>SNMP Walk Results for $host:$port</h3></center></td></tr>";
 	foreach ($a as $val) {
 		print "<tr><td>" . $val['oid'] . "</td><td>" . $val['value'] . "</td></tr>";
 	}
