mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #2131 from laf/issue-1936
Added ability to turn off icmp checks globally or per device
This commit is contained in:
@@ -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";
|
||||
|
@@ -2,6 +2,12 @@
|
||||
|
||||
echo '
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="icmp" class="col-sm-2 control-label">Disable ICMP Test?</label>
|
||||
<div class="col-sm-10">
|
||||
'.dynamic_override_config('checkbox','override_icmp_disable', $device).'
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="oxidized" class="col-sm-2 control-label">Exclude from Oxidized?</label>
|
||||
<div class="col-sm-10">
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user