mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
committed by
Neil Lathwood
parent
344dfb9797
commit
9bc0c542a5
28
daily.php
28
daily.php
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user