forked from librenms/librenms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ping.php
executable file
·45 lines (33 loc) · 842 Bytes
/
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
45
#!/usr/bin/env php
<?php
use App\Jobs\PingCheck;
$init_modules = ['alerts', 'laravel', 'nodb'];
require __DIR__ . '/includes/init.php';
$options = getopt('hdvg:');
if (isset($options['h'])) {
echo <<<'END'
ping.php: Usage ping.php [-d] [-v] [-g group(s)]
-d enable debug output
-v enable verbose debug output
-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;
}
if (isset($options['g'])) {
$groups = explode(',', $options['g']);
} else {
$groups = [];
}
if ($config['noinfluxdb'] !== true && $config['influxdb']['enable'] === true) {
$influxdb = influxdb_connect();
} else {
$influxdb = false;
}
rrdtool_initialize();
PingCheck::dispatch($groups);
rrdtool_close();