From 04101c2c6f7411b2f882b5ea05c6a5c1ef77cff5 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 15 Jul 2024 08:52:37 -0500 Subject: [PATCH] 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 --- LibreNMS/Data/Source/NetSnmpQuery.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LibreNMS/Data/Source/NetSnmpQuery.php b/LibreNMS/Data/Source/NetSnmpQuery.php index 0f68be1799..9808e6c60f 100644 --- a/LibreNMS/Data/Source/NetSnmpQuery.php +++ b/LibreNMS/Data/Source/NetSnmpQuery.php @@ -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 }