From 887bf702a58c83a561310a568727bbbfc19db751 Mon Sep 17 00:00:00 2001 From: "Costya.y" Date: Fri, 31 May 2019 17:52:16 +0300 Subject: [PATCH] Added custom snmp v2 community parameter. --- scripts/snmpsimd.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/snmpsimd.py b/scripts/snmpsimd.py index b9eafe3..9899e61 100644 --- a/scripts/snmpsimd.py +++ b/scripts/snmpsimd.py @@ -677,6 +677,7 @@ def probeContext(transportDomain, transportAddress, contextName): [--args-from-file=] [--transport-id-offset=] [--v2c-arch] + [--v2c-community] [--v3-only] [--v3-engine-id=] [--v3-context-engine-id=] @@ -707,7 +708,7 @@ def probeContext(transportDomain, transportAddress, contextName): 'daemonize', 'process-user=', 'process-group=', 'pid-file=', 'logging-method=', 'log-level=', 'device-dir=', 'cache-dir=', 'variation-modules-dir=', 'force-index-rebuild', - 'validate-device-data', 'validate-data', 'v2c-arch', 'v3-only', + 'validate-device-data', 'validate-data', 'v2c-arch', 'v2c-community=', 'v3-only', 'transport-id-offset=', 'variation-module-options=', 'args-from-file=', # this option starts new SNMPv3 engine configuration @@ -831,6 +832,9 @@ def probeContext(transportDomain, transportAddress, contextName): elif opt[0] == '--v2c-arch': v2cArch = True + elif opt[0] == '--v2c-community': + v2cCommunityName = opt[1] + elif opt[0] == '--v3-only': v3Only = True @@ -1088,6 +1092,8 @@ def configureManagedObjects(dataDirs, dataIndexInstrumController, log.msg.incIdent() for fullPath, textParser, communityName in getDataFiles(dataDir): + if v2cCommunityName: + communityName = v2cCommunityName if communityName in _dataFiles: log.error( 'ignoring duplicate Community/ContextName "%s" for data '