Debug and collect-snmp-data.php fixes (#12837)

Fix output so it can be captured and typo in collect-snmp-data.php
This commit is contained in:
Tony Murray 2021-05-05 10:27:10 -05:00 committed by GitHub
parent aa83e6aa1a
commit 76910e4180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 5 deletions

View File

@ -35,6 +35,13 @@ class Debug
private static $debug = false;
private static $verbose = false;
/**
* Enable/disable debug output
*
* @param bool $debug whether to enable or disable debug output
* @param bool $silence Silence error output or output all errors except notices
* @return bool returns $debug
*/
public static function set($debug = true, bool $silence = false): bool
{
self::$debug = (bool) $debug;

View File

@ -189,13 +189,13 @@ class ModuleTestHelper
// Run discovery
ob_start();
$save_debug = Debug::isEnabled();
$save_vedbug = Debug::isEnabled();
$save_vdebug = Debug::isVerbose();
Debug::set();
Debug::setVerbose();
Debug::setVerbose(false);
discover_device($device, $this->parseArgs('discovery'));
poll_device($device, $this->parseArgs('poller'));
Debug::set($save_debug);
Debug::setVerbose($save_vedbug);
Debug::setVerbose($save_vdebug);
$collection_output = ob_get_contents();
ob_end_clean();

View File

@ -96,6 +96,16 @@ return [
'level' => 'debug',
],
'stdout' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => \LibreNMS\Util\CliColorFormatter::class,
'with' => [
'stream' => 'php://output',
],
'level' => 'debug',
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),

View File

@ -85,9 +85,9 @@ For `data:` you have the following options:
The only sensor we have defined here is airflow. The available options
are as follows:
- `oid` (required): This is the name of the table you want to do the snmp walk on.
- `oid` (required): This is the name of the table you want to snmp walk for data.
- `value` (optional): This is the key within the table that contains
the value. If not provided willuse `oid`
the value. If not provided will use `oid`
- `num_oid` (required for PullRequests): If not provided, this parameter should be computed
automatically by discovery process. This parameter is still required to
submit a pull request. This is the numerical OID that contains