Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added custom snmp v2 community parameter. #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/snmpsimd.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ def probeContext(transportDomain, transportAddress, contextName):
[--args-from-file=<file>]
[--transport-id-offset=<number>]
[--v2c-arch]
[--v2c-community]
[--v3-only]
[--v3-engine-id=<hexvalue>]
[--v3-context-engine-id=<hexvalue>]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 '
Expand Down