2018-07-30 16:58:38 -05:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
use App\Jobs\PingCheck;
|
2020-05-19 22:08:41 -05:00
|
|
|
use LibreNMS\Data\Store\Datastore;
|
2018-07-30 16:58:38 -05:00
|
|
|
|
|
|
|
$init_modules = ['alerts', 'laravel', 'nodb'];
|
|
|
|
require __DIR__ . '/includes/init.php';
|
|
|
|
|
2020-02-26 03:32:14 +01:00
|
|
|
$options = getopt('hdvrg:');
|
2018-07-30 16:58:38 -05:00
|
|
|
|
|
|
|
if (isset($options['h'])) {
|
|
|
|
echo <<<'END'
|
2020-02-26 03:32:14 +01:00
|
|
|
ping.php: Usage ping.php [-d] [-v] [-r] [-g group(s)]
|
2018-07-30 16:58:38 -05:00
|
|
|
-d enable debug output
|
|
|
|
-v enable verbose debug output
|
2020-02-26 03:32:14 +01:00
|
|
|
-r do not create or update RRDs
|
2018-07-30 16:58:38 -05:00
|
|
|
-g only ping devices for this poller group, may be comma separated list
|
|
|
|
|
|
|
|
END;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_debug(isset($options['d']));
|
|
|
|
|
|
|
|
if (isset($options['v'])) {
|
|
|
|
global $vdebug;
|
|
|
|
$vdebug = true;
|
|
|
|
}
|
|
|
|
|
2020-05-19 22:08:41 -05:00
|
|
|
Datastore::init($options);
|
2020-02-26 03:32:14 +01:00
|
|
|
|
2018-07-30 16:58:38 -05:00
|
|
|
if (isset($options['g'])) {
|
|
|
|
$groups = explode(',', $options['g']);
|
|
|
|
} else {
|
|
|
|
$groups = [];
|
|
|
|
}
|
|
|
|
|
2018-11-12 09:27:28 -06:00
|
|
|
PingCheck::dispatch($groups);
|