Support specifying submodules in poller and discovery for debug (#8896)

Mostly useful for debugging

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:
Tony Murray
2018-07-12 15:30:39 -05:00
committed by Neil Lathwood
parent 33887417ee
commit 846cf11331
12 changed files with 129 additions and 66 deletions

View File

@@ -11,6 +11,8 @@
* @copyright (C) 2006 - 2012 Adam Armstrong
*/
use LibreNMS\Config;
$init_modules = array('polling', 'alerts');
require __DIR__ . '/includes/init.php';
@@ -58,18 +60,18 @@ if (isset($options['i']) && $options['i'] && isset($options['n'])) {
if (!$where) {
echo "-h <device id> | <device hostname wildcard> Poll single device\n";
echo "-h odd Poll odd numbered devices (same as -i 2 -n 0)\n";
echo "-h even Poll even numbered devices (same as -i 2 -n 1)\n";
echo "-h all Poll all devices\n\n";
echo "-h odd Poll odd numbered devices (same as -i 2 -n 0)\n";
echo "-h even Poll even numbered devices (same as -i 2 -n 1)\n";
echo "-h all Poll all devices\n\n";
echo "-i <instances> -n <number> Poll as instance <number> of <instances>\n";
echo " Instances start at 0. 0-3 for -n 4\n\n";
echo " Instances start at 0. 0-3 for -n 4\n\n";
echo "Debugging and testing options:\n";
echo "-r Do not create or update RRDs\n";
echo "-f Do not insert data into InfluxDB\n";
echo "-p Do not insert data into Prometheus\n";
echo "-d Enable debugging output\n";
echo "-v Enable verbose debugging output\n";
echo "-m Specify module(s) to be run\n";
echo "-r Do not create or update RRDs\n";
echo "-f Do not insert data into InfluxDB\n";
echo "-p Do not insert data into Prometheus\n";
echo "-d Enable debugging output\n";
echo "-v Enable verbose debugging output\n";
echo "-m Specify module(s) to be run. Comma separate modules, submodules may be added with /\n";
echo "\n";
echo "No polling type specified!\n";
exit;
@@ -142,6 +144,9 @@ if ($config['nographite'] !== true && $config['graphite']['enable'] === true) {
$graphite = false;
}
// If we've specified modules with -m, use them
$module_override = parse_modules('poller', $options);
rrdtool_initialize();
echo "Starting polling run:\n\n";
@@ -158,7 +163,7 @@ foreach (dbFetch($query) as $device) {
$device['vrf_lite_cisco'] = '';
}
if (!poll_device($device, $options)) {
if (!poll_device($device, $module_override)) {
$unreachable_devices++;
}