diff --git a/html/pages/addhost.inc.php b/html/pages/addhost.inc.php
index 4ab7dc271..b2bb5e792 100644
--- a/html/pages/addhost.inc.php
+++ b/html/pages/addhost.inc.php
@@ -23,7 +23,7 @@ if ($_POST['hostname'])
}
$snmpver = mres($_POST['snmpver']);
- if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
+ if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = $config['snmp']['port']; }
print_message("Adding host $hostname communit" . (count($config['snmp']['community']) == 1 ? "y" : "ies") . " " . implode(', ',$config['snmp']['community']) . " port $port");
}
elseif ($_POST['snmpver'] === "v3")
@@ -41,7 +41,7 @@ if ($_POST['hostname'])
$snmpver = "v3";
- if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
+ if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = $config['snmp']['port']; }
print_message("Adding SNMPv3 host $hostname port $port");
}
else
diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php
index 1256d42db..a0e0ad167 100644
--- a/includes/defaults.inc.php
+++ b/includes/defaults.inc.php
@@ -141,6 +141,7 @@ $config['snmp']['version'] = "v2c"; # Default version to use
# SNMPv1/2c default settings
$config['snmp']['community'][0] = "public"; # Communities to try during adding hosts and discovery
+$config['snmp']['port'] = 161; # Port Client SNMP is running on
# SNMPv3 default settings
# The array can be expanded to give another set of parameters