librenms/ping.php
Tony Murray 9bc0c542a5 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`
2018-07-30 22:58:38 +01:00

46 lines
857 B
PHP
Executable File

#!/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(new PingCheck($groups));
rrdtool_close();