fix: Fixed the default fping config + changed variable name (#8060)

* fix: Fixed the default fping config and added docs on caveats to changing timeout

* millisec -> interval

* removed retries config option, no needed

* Update Performance.md
This commit is contained in:
Neil Lathwood 2018-01-09 20:16:48 +00:00 committed by GitHub
parent b2a54dae3b
commit 0a7ec12fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 20 deletions

View File

@ -68,20 +68,28 @@ Please see [1 Minute polling](1-Minute-Polling.md) for information on configurin
```php
$config['fping'] = "/usr/bin/fping";
$config['fping6'] = "fping6";
$config['fping_options']['retries'] = 3;
$config['fping_options']['timeout'] = 500;
$config['fping_options']['count'] = 3;
$config['fping_options']['millisec'] = 200;
$config['fping_options']['interval'] = 500;
```
`fping` configuration options:
* `retries` (`fping` parameter `-r`): Number of times an attempt at pinging a target will be made, not including the first try.
* `timeout` (`fping` parameter `-t`): Amount of time that fping waits for a response to its first request (in milliseconds).
* `timeout` (`fping` parameter `-t`): Amount of time that fping waits for a response to its first request (in milliseconds). **See note below**
* `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.
* `interval` (`fping` parameter `-p`): Time in milliseconds that fping waits between successive packets to an individual target.
> NOTE: Setting a higher timeout value than the interval value can lead to slowing down poller. Example:
>
> timeout: 3000
>
> count: 3
>
> interval: 500
>
> In this example, interval will be overwritten by the timeout value of 3000 which is 3 seconds. As we send three icmp packets (count: 3), each one is delayed by 3 seconds which will result in fping taking > 6 seconds to return results.
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
**We don't advise 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:

View File

@ -60,6 +60,29 @@ You can also set this globally with the config option `$config['snmp']['max_oid'
> NOTE: It is advisable to monitor sensor polling when you change this to ensure you don't set the value too high.
### fping tuning
You can change some of the default fping options used globally or per device. The defaults are:
```php
$config['fping_options']['timeout'] = 500;
$config['fping_options']['count'] = 3;
$config['fping_options']['interval'] = 500;
```
If your devices are slow to respond then you will need to increase the timeout value and potentially the interval value.
However if your network is stable, you can increase poller performance by dropping the count value to 1 and/or the timeout+millsec value to 200 or 300:
```php
$config['fping_options']['timeout'] = 300;
$config['fping_options']['count'] = 1;
$config['fping_options']['interval'] = 300;
```
This will mean that we no longer delay each icmp packet sent (we send 3 in total by default) by 0.5 seconds. With only 1 icmp packet
being sent then we will receive a response quicker. The defaults mean it will take at least 1 second for a response no matter how
quick the icmp packet is returned.
### Optimise poller-wrapper
The default 16 threads that `poller-wrapper.py` runs as isn't necessarily the optimal number. A general rule of thumb is

View File

@ -44,10 +44,10 @@ $config['own_hostname'] = 'localhost';
// Location of executables
//$config['fping'] = '/usr/sbin/fping';
//$config['fping6'] = '/usr/sbin/fping6';
$config['fping_options']['retries'] = 3;
// https://docs.librenms.org/Support/Configuration/#fping
$config['fping_options']['timeout'] = 500;
$config['fping_options']['count'] = 3;
$config['fping_options']['millisec'] = 200;
$config['fping_options']['interval'] = 500;
$config['snmpwalk'] = '/usr/bin/snmpwalk';
$config['snmpget'] = '/usr/bin/snmpget';
$config['snmpbulkwalk'] = '/usr/bin/snmpbulkwalk';

View File

@ -657,29 +657,23 @@ function isPingable($hostname, $address_family = AF_INET, $attribs = array())
$response = array();
if (can_ping_device($attribs) === true) {
$fping_params = '';
if (is_numeric($config['fping_options']['retries']) && $config['fping_options']['retries'] > 0) {
if ($config['fping_options']['retries'] > 20) {
$config['fping_options']['retries'] = 20;
}
$fping_params .= ' -r ' . $config['fping_options']['retries'];
}
if (is_numeric($config['fping_options']['timeout'])) {
if ($config['fping_options']['timeout'] < 50) {
$config['fping_options']['timeout'] = 50;
}
if ($config['fping_options']['millisec'] < $config['fping_options']['timeout']) {
$config['fping_options']['millisec'] = $config['fping_options']['timeout'];
if ($config['fping_options']['interval'] < $config['fping_options']['timeout']) {
$config['fping_options']['interval'] = $config['fping_options']['timeout'];
}
$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'])) {
if ($config['fping_options']['millisec'] < 20) {
$config['fping_options']['millisec'] = 20;
if (is_numeric($config['fping_options']['interval'])) {
if ($config['fping_options']['interval'] < 20) {
$config['fping_options']['interval'] = 20;
}
$fping_params .= ' -p ' . $config['fping_options']['millisec'];
$fping_params .= ' -p ' . $config['fping_options']['interval'];
}
$status = fping($hostname, $fping_params, $address_family);
if ($status['exitcode'] > 0 || $status['loss'] == 100) {

View File

@ -45,6 +45,10 @@ if ($config['rrdgraph_real_95th']) {
$config['rrdgraph_real_percentile'] = $config['rrdgraph_real_95th'];
}
if (isset($config['fping_options']['millisec']) && is_numeric($config['fping_options']['millisec'])) {
$config['fping_options']['interval'] = $config['fping_options']['millisec'];
}
// make sure we have full path to binaries in case PATH isn't set
foreach (array('fping', 'fping6', 'snmpgetnext') as $bin) {
if (!is_executable(Config::get($bin))) {