diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 865b00b9b5..7ffdffe08c 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -59,6 +59,17 @@ $config['fping_options']['millisec'] = 200; * `count` (`fping` parameter `-c`): Number of request packets to send to each target. * `millisec` (`fping` parameter `-p`): Time in milliseconds that fping waits between successive packets to an individual target. +You can disable the fping / icmp check that is done for a device to be determined to be up on a global or per device basis. +**We don't advice disabling the fping / icmp check unless you know the impact, at worst if you have a large number of devices down +then it's possible that the poller would no longer complete in 5 minutes due to waiting for snmp to timeout.** + +Globally disable fping / icmp check: +```php +$config['icmp_check'] = false; +``` + +If you would like to do this on a per device basis then you can do so under Device -> Edit -> Misc -> Disable ICMP Test? On + ```php $config['snmpwalk'] = "/usr/bin/snmpwalk"; $config['snmpget'] = "/usr/bin/snmpget"; diff --git a/html/pages/device/edit/misc.inc.php b/html/pages/device/edit/misc.inc.php index 5f66c88fd7..a856898523 100644 --- a/html/pages/device/edit/misc.inc.php +++ b/html/pages/device/edit/misc.inc.php @@ -2,6 +2,12 @@ echo '
+
+ +
+ '.dynamic_override_config('checkbox','override_icmp_disable', $device).' +
+
diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index ed643cd7f3..f3af33e222 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -195,6 +195,8 @@ $config['snmp']['v3'][0]['cryptopass'] = ''; $config['snmp']['v3'][0]['cryptoalgo'] = 'AES'; // AES | DES +// Devices must respond to icmp by default +$config['icmp_check'] = true; // Autodiscovery Settings $config['autodiscovery']['xdp'] = true; diff --git a/includes/functions.php b/includes/functions.php index 42e9d0b251..319adb0740 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -490,31 +490,39 @@ function isSNMPable($device) { function isPingable($hostname, $address_family = AF_INET, $device_id = FALSE) { global $config; - $fping_params = ''; - if(is_numeric($config['fping_options']['retries']) || $config['fping_options']['retries'] > 1) { - $fping_params .= ' -r ' . $config['fping_options']['retries']; - } - if(is_numeric($config['fping_options']['timeout']) || $config['fping_options']['timeout'] > 1) { - $fping_params .= ' -t ' . $config['fping_options']['timeout']; - } - if(is_numeric($config['fping_options']['count']) || $config['fping_options']['count'] > 0) { - $fping_params .= ' -c ' . $config['fping_options']['count']; - } - if(is_numeric($config['fping_options']['millisec']) || $config['fping_options']['millisec'] > 0) { - $fping_params .= ' -p ' . $config['fping_options']['millisec']; - } + $tmp_device = array('device_id'=>$device_id); $response = array(); - $status = fping($hostname,$fping_params,$address_family); - if ($status['loss'] == 100) { - $response['result'] = FALSE; + if ($config['icmp_check'] === true && get_dev_attrib($tmp_device,'override_icmp_disable') != "true") { + + $fping_params = ''; + if(is_numeric($config['fping_options']['retries']) || $config['fping_options']['retries'] > 1) { + $fping_params .= ' -r ' . $config['fping_options']['retries']; + } + if(is_numeric($config['fping_options']['timeout']) || $config['fping_options']['timeout'] > 1) { + $fping_params .= ' -t ' . $config['fping_options']['timeout']; + } + if(is_numeric($config['fping_options']['count']) || $config['fping_options']['count'] > 0) { + $fping_params .= ' -c ' . $config['fping_options']['count']; + } + if(is_numeric($config['fping_options']['millisec']) || $config['fping_options']['millisec'] > 0) { + $fping_params .= ' -p ' . $config['fping_options']['millisec']; + } + $status = fping($hostname,$fping_params,$address_family); + if ($status['loss'] == 100) { + $response['result'] = FALSE; + } + else { + $response['result'] = TRUE; + } + if (is_numeric($status['avg'])) { + $response['last_ping_timetaken'] = $status['avg']; + } + $response['db'] = $status; } else { - $response['result'] = TRUE; + $response['result'] = true; + $response['last_ping_timetaken'] = 0; } - if (is_numeric($status['avg'])) { - $response['last_ping_timetaken'] = $status['avg']; - } - $response['db'] = $status; return($response); }