added oids.no_bulk os setting (#13666)

* forcewalk param

* [snmp][no_bulk]

* var names, test, schema

* Key off OIDs, not mibs

luminato is POC and needs to be reverted before merge.

* fix up os schema

* docs

* remove luminato arbitrary changes

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Peca Nesovanovic
2022-01-15 16:59:23 +01:00
committed by GitHub
parent 3e0d8b8a24
commit 592a0efa51
8 changed files with 5074 additions and 4 deletions

View File

@@ -269,7 +269,7 @@ class NetSnmpQuery implements SnmpQueryInterface
private function buildCli(string $command, array $oids): array
{
$cmd = $this->initCommand($command);
$cmd = $this->initCommand($command, $oids);
array_push($cmd, '-M', $this->mibDirectories());
@@ -349,9 +349,13 @@ class NetSnmpQuery implements SnmpQueryInterface
return new SnmpResponse($output, $stderr, $exitCode);
}
private function initCommand(string $binary): array
private function initCommand(string $binary, array $oids): array
{
if ($binary == 'snmpwalk' && $this->device->snmpver !== 'v1' && Config::getOsSetting($this->device->os, 'snmp_bulk', true)) {
if ($binary == 'snmpwalk'
&& $this->device->snmpver !== 'v1'
&& Config::getOsSetting($this->device->os, 'snmp_bulk', true)
&& empty(array_intersect($oids, Config::getCombined($this->device->os, 'oids.no_bulk'))) // skip for oids that do not work with bulk
) {
$snmpcmd = [Config::get('snmpbulkwalk', 'snmpbulkwalk')];
$max_repeaters = $this->device->getAttrib('snmp_max_repeaters') ?: Config::getOsSetting($this->device->os, 'snmp.max_repeaters', Config::get('snmp.max_repeaters', false));