Added TOS support for fping (#13496)

* TOS support for fping in LibreNMS/Data/Source/Fping.php

* TOS support for fping in app/Jobs/PingCheck.php

* Doc

* Improve doc
This commit is contained in:
PipoCanaja
2021-11-11 22:33:01 +01:00
committed by GitHub
parent 18992df7b0
commit 29f1cb53ab
3 changed files with 7 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ class Fping
$interval = max($interval, 20); $interval = max($interval, 20);
$fping = Config::get('fping'); $fping = Config::get('fping');
$fping_tos = Config::get('fping_options.tos', 0);
$cmd = [$fping]; $cmd = [$fping];
if ($address_family == 'ipv6') { if ($address_family == 'ipv6') {
$fping6 = Config::get('fping6'); $fping6 = Config::get('fping6');
@@ -62,6 +63,8 @@ class Fping
$interval, $interval,
'-t', '-t',
max($timeout, $interval), max($timeout, $interval),
'-O',
$fping_tos,
$host, $host,
]); ]);

View File

@@ -82,8 +82,9 @@ class PingCheck implements ShouldQueue
// set up fping process // set up fping process
$timeout = Config::get('fping_options.timeout', 500); // must be smaller than period $timeout = Config::get('fping_options.timeout', 500); // must be smaller than period
$retries = Config::get('fping_options.retries', 2); // how many retries on failure $retries = Config::get('fping_options.retries', 2); // how many retries on failure
$tos = Config::get('fping_options.tos', 0); // TOS marking
$this->command = ['fping', '-f', '-', '-e', '-t', $timeout, '-r', $retries]; $this->command = ['fping', '-f', '-', '-e', '-t', $timeout, '-r', $retries, '-O', $tos];
$this->wait = Config::get('rrd.step', 300) * 2; $this->wait = Config::get('rrd.step', 300) * 2;
} }

View File

@@ -167,6 +167,7 @@ lnms config:set fping6 fping6
lnms config:set fping_options.timeout 500 lnms config:set fping_options.timeout 500
lnms config:set fping_options.count 3 lnms config:set fping_options.count 3
lnms config:set fping_options.interval 500 lnms config:set fping_options.interval 500
lnms config:set fping_options.tos 184
``` ```
`fping` configuration options: `fping` configuration options:
@@ -178,6 +179,7 @@ lnms config:set fping_options.interval 500
to each target. to each target.
* `interval` (`fping` parameter `-p`): Time in milliseconds that fping * `interval` (`fping` parameter `-p`): Time in milliseconds that fping
waits between successive packets to an individual target. waits between successive packets to an individual target.
* `tos` (`fping`parameter `-O`): Set the type of service flag (TOS). Value can be either decimal or hexadecimal (0xh) format. Can be used to ensure that ping packets are queued in following QOS mecanisms in the network. Table is accessible in the [TOS Wikipedia page](https://en.wikipedia.org/wiki/Type_of_service).
> NOTE: Setting a higher timeout value than the interval value can > NOTE: Setting a higher timeout value than the interval value can
> lead to slowing down poller. Example: > lead to slowing down poller. Example: