Allow ping checks to be ran separately from polling (#8821)

Allows ping checks at intervals not tied to the poller.  Pointless if you are not alerting on device status.
I updated the rrdstep.php script to treat ping-perf files separately and made it so it only converts if needed.

Docs here: https://docs.librenms.org/Extensions/Fast-Ping-Check/

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
This commit is contained in:
Tony Murray
2018-07-30 16:58:38 -05:00
committed by Neil Lathwood
parent 344dfb9797
commit 9bc0c542a5
20 changed files with 864 additions and 112 deletions

View File

@@ -6,6 +6,8 @@
* (c) 2013 LibreNMS Contributors
*/
use App\Models\Device;
use Illuminate\Database\Eloquent\Collection;
use LibreNMS\Config;
use LibreNMS\Exceptions\LockException;
use LibreNMS\Util\MemcacheLock;
@@ -294,3 +296,29 @@ if ($options['f'] === 'refresh_os_cache') {
echo 'Clearing OS cache' . PHP_EOL;
unlink(Config::get('install_dir') . '/cache/os_defs.cache');
}
if ($options['f'] === 'recalculate_device_dependencies') {
// fix broken dependency max_depth calculation in case things weren't done though eloquent
try {
if (Config::get('distributed_poller')) {
MemcacheLock::lock('recalculate_device_dependencies', 0, 86000);
}
\LibreNMS\DB\Eloquent::boot();
// update all root nodes and recurse, chunk so we don't blow up
Device::doesntHave('parents')->with('children')->chunk(100, function (Collection $devices) {
// anonymous recursive function
$recurse = function (Device $device) use (&$recurse) {
$device->updateMaxDepth();
$device->children->each($recurse);
};
$devices->each($recurse);
});
} catch (LockException $e) {
echo $e->getMessage() . PHP_EOL;
exit(-1);
}
}