mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
save-test-data.php: Print a message when we encounter a bad module name (#8274)
* Print a message when we encounter a bad module name (likely a typo) * Raise exception for invalid module name and handle it.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use LibreNMS\Exceptions\InvalidModuleException;
|
||||
use LibreNMS\Util\ModuleTestHelper;
|
||||
use LibreNMS\Util\Snmpsim;
|
||||
|
||||
@@ -104,17 +105,21 @@ if ($variant) {
|
||||
}
|
||||
echo PHP_EOL;
|
||||
|
||||
$capture = new ModuleTestHelper($modules, $target_os, $variant);
|
||||
try {
|
||||
$capture = new ModuleTestHelper($modules, $target_os, $variant);
|
||||
|
||||
|
||||
if (isset($options['f'])) {
|
||||
$capture->setSnmprecSavePath($options['f']);
|
||||
} elseif (isset($options['file'])) {
|
||||
$capture->setSnmprecSavePath($options['file']);
|
||||
if (isset($options['f'])) {
|
||||
$capture->setSnmprecSavePath($options['f']);
|
||||
} elseif (isset($options['file'])) {
|
||||
$capture->setSnmprecSavePath($options['file']);
|
||||
}
|
||||
|
||||
$prefer_new_snmprec = isset($options['n']) || isset($options['prefer-new']);
|
||||
|
||||
|
||||
echo "Capturing Data: ";
|
||||
$capture->captureFromDevice($device['device_id'], true, $prefer_new_snmprec);
|
||||
} catch (InvalidModuleException $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
||||
$prefer_new_snmprec = isset($options['n']) || isset($options['prefer-new']);
|
||||
|
||||
|
||||
echo "Capturing Data: ";
|
||||
$capture->captureFromDevice($device['device_id'], true, $prefer_new_snmprec);
|
||||
|
Reference in New Issue
Block a user