mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 02:18:39 +00:00
Fix Fast Ping (#12509)
Recent Laravel version update broke ping.php by now serializing the PingCheck job. Store process parameters instead of process object.
This commit is contained in:
parent
ee1606d799
commit
aa7fa09c89
@ -43,7 +43,8 @@ class PingCheck implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
private $process;
|
||||
private $command;
|
||||
private $wait;
|
||||
private $rrd_tags;
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Collection List of devices keyed by hostname */
|
||||
@ -80,11 +81,8 @@ class PingCheck implements ShouldQueue
|
||||
$timeout = Config::get('fping_options.timeout', 500); // must be smaller than period
|
||||
$retries = Config::get('fping_options.retries', 2); // how many retries on failure
|
||||
|
||||
$cmd = ['fping', '-f', '-', '-e', '-t', $timeout, '-r', $retries];
|
||||
|
||||
$wait = Config::get('rrd.step', 300) * 2;
|
||||
|
||||
$this->process = new Process($cmd, null, null, null, $wait);
|
||||
$this->command = ['fping', '-f', '-', '-e', '-t', $timeout, '-r', $retries];
|
||||
$this->wait = Config::get('rrd.step', 300) * 2;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,7 +96,9 @@ class PingCheck implements ShouldQueue
|
||||
|
||||
$this->fetchDevices();
|
||||
|
||||
d_echo($this->process->getCommandLine() . PHP_EOL);
|
||||
$process = new Process($this->command, null, null, null, $this->wait);
|
||||
|
||||
d_echo($process->getCommandLine() . PHP_EOL);
|
||||
|
||||
// send hostnames to stdin to avoid overflowing cli length limits
|
||||
$ordered_device_list = $this->tiered->get(1, collect())->keys()// root nodes before standalone nodes
|
||||
@ -106,10 +106,10 @@ class PingCheck implements ShouldQueue
|
||||
->unique()
|
||||
->implode(PHP_EOL);
|
||||
|
||||
$this->process->setInput($ordered_device_list);
|
||||
$this->process->start(); // start as early as possible
|
||||
$process->setInput($ordered_device_list);
|
||||
$process->start(); // start as early as possible
|
||||
|
||||
foreach ($this->process as $type => $line) {
|
||||
foreach ($process as $type => $line) {
|
||||
d_echo($line);
|
||||
|
||||
if (Process::ERR === $type) {
|
||||
|
Loading…
Reference in New Issue
Block a user