Connectivity Helper to check and record device reachability (#13315)

* Fping WIP

* Update availability, move ping rrd update in the same place as db update.

* move classes around

* make device:ping command work

* use new code, remove legacy code

* save metrics boolean prevents all saves
style fixes

* update device array

* style fixes

* Update unit test

* fix whitespace

* Fix Fping stub

* fix backwards if

* fix phpstan complaining

* Fix return type

* add fillable to DeviceOutage model.

* device_outage migration to add id...

* missed line in db_schema.yaml

* 1 billion more comments on the brain damage up/down code

* tests for status and status_reason fields

* fix style again :D

* Duplicate legacy isSNMPable() functionality
but with only one snmp call ever 😎

* Remove unused variable

* fix migrations for sqlite
This commit is contained in:
Tony Murray
2021-10-03 22:45:10 -05:00
committed by GitHub
parent d443d2b4b1
commit aa35d2f0c0
18 changed files with 722 additions and 292 deletions

View File

@@ -28,9 +28,10 @@ namespace LibreNMS\Tests;
use DeviceCache;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use LibreNMS\Config;
use LibreNMS\Data\Source\Fping;
use LibreNMS\Data\Source\FpingResponse;
use LibreNMS\Exceptions\FileNotFoundException;
use LibreNMS\Exceptions\InvalidModuleException;
use LibreNMS\Fping;
use LibreNMS\Util\Debug;
use LibreNMS\Util\ModuleTestHelper;
@@ -172,17 +173,8 @@ class OSModulesTest extends DBTestCase
});
$this->app->bind(Fping::class, function ($app) {
$mock = \Mockery::mock('\LibreNMS\Fping');
$mock->shouldReceive('ping')->andReturn([
'xmt' => 3,
'rcv' => 3,
'loss' => 0,
'min' => 0.62,
'max' => 0.93,
'avg' => 0.71,
'dup' => 0,
'exitcode' => 0,
]);
$mock = \Mockery::mock('\LibreNMS\Data\Source\Fping');
$mock->shouldReceive('ping')->andReturn(FpingResponse::artificialUp());
return $mock;
});