Merge pull request #3781 from laf/max-repeaters

This commit is contained in:
Søren Rosiak
2016-07-12 21:21:16 +02:00
committed by GitHub
3 changed files with 59 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
- [Why do I see traffic spikes in my graphs?](#faq15)
- [Why do I see gaps in my graphs?](#faq17)
- [How do I change the IP / hostname of a device?](#faq16)
- [My device doesn't finish polling within 300 seconds](#faq19)
- [Things aren't working correctly?](#faq18)
### Developing
@@ -120,6 +121,14 @@ Usage:
./renamehost.php <old hostname> <new hostname>
```
#### <a name="faq19"> My device doesn't finish polling within 300 seconds</a>
We have a few things you can try:
- Disable unnecessary polling modules under edit device.
- Set a max repeater value within the snmp settings for a device.
What to set this to is tricky, you really should run an snmpbulkwalk with -Cr10 through -Cr50 to see what works best. 50 is usually a good choice if the device can cope.
#### <a name="faq18"> Things aren't working correctly?</a>
Run `./validate.php` as root from within your install.

View File

@@ -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']),
@@ -49,12 +50,28 @@ if ($_POST['editing']) {
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 "
<form id='edit' name='edit' method='post' action='' role='form' class='form-horizontal'>
<input type=hidden name='editing' value='yes'>
@@ -137,6 +156,12 @@ foreach (get_port_assoc_modes() as $pam) {
echo " </select>
</div>
</div>
<div class='form-group'>
<label for='max_repeaters' class='col-sm-2 control-label'>Max Repeaters</label>
<div class='col-sm-1'>
<input id='max_repeaters' name='max_repeaters' class='form-control input-sm' value='".$max_repeaters."' placeholder='max rep' />
</div>
</div>
<div id='snmpv1_2'>
<div class='form-group'>
<label class='col-sm-3 control-label text-left'><h4><strong>SNMPv1/v2c Configuration</strong></h4></label>

View File

@@ -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;