From 29f1cb53ab367b076ba8f684b8b754ad79a2f637 Mon Sep 17 00:00:00 2001 From: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com> Date: Thu, 11 Nov 2021 22:33:01 +0100 Subject: [PATCH] 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 --- LibreNMS/Data/Source/Fping.php | 3 +++ app/Jobs/PingCheck.php | 3 ++- doc/Support/Configuration.md | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/LibreNMS/Data/Source/Fping.php b/LibreNMS/Data/Source/Fping.php index 9ad173e43e..b69514bef8 100644 --- a/LibreNMS/Data/Source/Fping.php +++ b/LibreNMS/Data/Source/Fping.php @@ -46,6 +46,7 @@ class Fping $interval = max($interval, 20); $fping = Config::get('fping'); + $fping_tos = Config::get('fping_options.tos', 0); $cmd = [$fping]; if ($address_family == 'ipv6') { $fping6 = Config::get('fping6'); @@ -62,6 +63,8 @@ class Fping $interval, '-t', max($timeout, $interval), + '-O', + $fping_tos, $host, ]); diff --git a/app/Jobs/PingCheck.php b/app/Jobs/PingCheck.php index 8e4e2f1e69..82492f058c 100644 --- a/app/Jobs/PingCheck.php +++ b/app/Jobs/PingCheck.php @@ -82,8 +82,9 @@ class PingCheck implements ShouldQueue // set up fping process $timeout = Config::get('fping_options.timeout', 500); // must be smaller than period $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; } diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 15721baa80..4c93fb3cea 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -167,6 +167,7 @@ lnms config:set fping6 fping6 lnms config:set fping_options.timeout 500 lnms config:set fping_options.count 3 lnms config:set fping_options.interval 500 +lnms config:set fping_options.tos 184 ``` `fping` configuration options: @@ -178,6 +179,7 @@ lnms config:set fping_options.interval 500 to each target. * `interval` (`fping` parameter `-p`): Time in milliseconds that fping 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 > lead to slowing down poller. Example: