SnmpQuery default improvements (#16204)

Always ignore underscores. Vendors constantly break this rule and it doesn't seem to have any side effects to enable -Pu.
translate respect hideMib() option
This commit is contained in:
Tony Murray
2024-07-15 08:52:37 -05:00
committed by GitHub
parent a87ed6dcc5
commit 04101c2c6f

View File

@@ -80,7 +80,7 @@ class NetSnmpQuery implements SnmpQueryInterface
*/
private array $mibDirs = [];
private string $context = '';
private array|string $options = [self::DEFAULT_FLAGS];
private array|string $options = [self::DEFAULT_FLAGS, '-Pu'];
private Device $device;
private bool $abort = false;
private bool $cache = false;
@@ -312,7 +312,9 @@ class NetSnmpQuery implements SnmpQueryInterface
// user did not specify numeric, output full text
if (! in_array('-On', $this->options)) {
$this->options[] = '-OS';
if (! in_array('-Os', $this->options)) {
$this->options[] = '-OS'; // show full oid, unless hideMib is set
}
} elseif (Oid::isNumeric($oid)) {
return Str::start($oid, '.'); // numeric to numeric optimization
}