diff --git a/html/pages/device/edit/snmp.inc.php b/html/pages/device/edit/snmp.inc.php index d3af2ac0d2..0634a778f6 100644 --- a/html/pages/device/edit/snmp.inc.php +++ b/html/pages/device/edit/snmp.inc.php @@ -10,6 +10,7 @@ if ($_POST['editing']) { $retries = mres($_POST['retries']); $poller_group = mres($_POST['poller_group']); $port_assoc_mode = mres($_POST['port_assoc_mode']); + $max_repeaters = mres($_POST['max_repeaters']); $v3 = array( 'authlevel' => mres($_POST['authlevel']), 'authname' => mres($_POST['authname']), @@ -48,13 +49,29 @@ if ($_POST['editing']) { $device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3, $port_assoc_mode); if (isSNMPable($device_tmp)) { $rows_updated = dbUpdate($update, 'devices', '`device_id` = ?', array($device['device_id'])); + + $max_repeaters_set = false; + + if (is_numeric($max_repeaters) && $max_repeaters != 0) { + set_dev_attrib($device, 'snmp_max_repeaters', $max_repeaters); + $max_repeaters_set = true; + } + else { + del_dev_attrib($device, 'snmp_max_repeaters'); + $max_repeaters_set = true; + } if ($rows_updated > 0) { $update_message = $rows_updated.' Device record updated.'; $updated = 1; } else if ($rows_updated = '-1') { - $update_message = 'Device record unchanged. No update necessary.'; + if ($max_repeaters_set === true) { + $update_message = 'SNMP Max repeaters updated, no other changes made'; + } + else { + $update_message = 'Device record unchanged. No update necessary.'; + } $updated = -1; } else { @@ -79,6 +96,8 @@ else if ($update_message) { print_error($update_message); } +$max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); + echo "
@@ -137,6 +156,12 @@ foreach (get_port_assoc_modes() as $pam) { echo " +
+ +
+ +
+
diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 267ed10db2..13bf3de5d1 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -167,6 +167,10 @@ function snmp_walk($device, $oid, $options=null, $mib=null, $mibdir=null) { } else { $snmpcommand = $config['snmpbulkwalk']; + $max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); + if ($max_repeaters > 0) { + $snmpcommand .= " -Cr$max_repeaters "; + } } $cmd = $snmpcommand; @@ -230,6 +234,10 @@ function snmpwalk_cache_cip($device, $oid, $array=array(), $mib=0) { } else { $snmpcommand = $config['snmpbulkwalk']; + $max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); + if ($max_repeaters > 0) { + $snmpcommand .= " -Cr$max_repeaters "; + } } $cmd = $snmpcommand; @@ -301,6 +309,10 @@ function snmp_cache_ifIndex($device) { } else { $snmpcommand = $config['snmpbulkwalk']; + $max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); + if ($max_repeaters > 0) { + $snmpcommand .= " -Cr$max_repeaters "; + } } $cmd = $snmpcommand; @@ -461,6 +473,10 @@ function snmpwalk_cache_twopart_oid($device, $oid, $array, $mib=0) { } else { $snmpcommand = $config['snmpbulkwalk']; + $max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); + if ($max_repeaters > 0) { + $snmpcommand .= " -Cr$max_repeaters "; + } } $cmd = $snmpcommand; @@ -515,6 +531,10 @@ function snmpwalk_cache_threepart_oid($device, $oid, $array, $mib=0) { } else { $snmpcommand = $config['snmpbulkwalk']; + $max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); + if ($max_repeaters > 0) { + $snmpcommand .= " -Cr$max_repeaters "; + } } $cmd = $snmpcommand; @@ -573,6 +593,10 @@ function snmp_cache_slotport_oid($oid, $device, $array, $mib=0) { } else { $snmpcommand = $config['snmpbulkwalk']; + $max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters'); + if ($max_repeaters > 0) { + $snmpcommand .= " -Cr$max_repeaters "; + } } $cmd = $snmpcommand;