forked from librenms/librenms
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ping.php
executable file
·44 lines (34 loc) · 1.06 KB
/
ping.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env php
<?php
use App\Jobs\PingCheck;
use LibreNMS\Data\Store\Datastore;
use LibreNMS\Util\Debug;
$init_modules = ['alerts', 'laravel', 'nodb'];
require __DIR__ . '/includes/init.php';
$options = getopt('fhdvrg:');
if (isset($options['h'])) {
echo <<<'END'
ping.php: Usage ping.php [-d] [-v] [-r] [-g group(s)]
-d enable debug output
-v enable verbose debug output
-r do not create or update RRDs
-g only ping devices for this poller group, may be comma separated list
END;
exit;
}
$scheduler = \LibreNMS\Config::get('schedule_type.ping');
if (! isset($options['f']) && $scheduler != 'legacy' && $scheduler != 'cron') {
if (Debug::isEnabled()) {
echo "Fast Pings are not enabled for cron scheduling. Add the -f command argument if you want to force this command to run.\n";
}
exit(0);
}
Debug::set(isset($options['d']));
Debug::setVerbose(isset($options['v']));
Datastore::init($options);
if (isset($options['g'])) {
$groups = explode(',', $options['g']);
} else {
$groups = [];
}
PingCheck::dispatchSync($groups);