Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Added support for multiple communities #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"auth": {
"version2": {
"enabled": true,
"community": "public"
"community": ["public", "private"]
},
"version3": {
"enabled": true,
Expand Down
2 changes: 1 addition & 1 deletion conf/config.json.default
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"auth": {
"version2": {
"enabled": true,
"community": "public"
"community": ["public", "private"]
},
"version3": {
"enabled": true,
Expand Down
7 changes: 4 additions & 3 deletions src/sensu/snmp/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ def _configure_tcp_transport(self, listen_address, listen_port):
#log.info("TrapReceiver: Initialized SNMP TCP Transport on %s:%s" % (listen_address, listen_port))
pass

def _configure_snmp_v2(self, community):
def _configure_snmp_v2(self, communities):
# v1/2 setup
pysnmp.entity.config.addV1System(self._snmp_engine, 'sensu-trapd-agent', community)
log.debug("TrapReceiver: Initialized SNMPv1 Auth")
for community in communities:
pysnmp.entity.config.addV1System(self._snmp_engine, "sensu-trapd-agent-%s" % community, community)
log.debug("TrapReceiver: Initialized SNMPv1 Auth with community '%s'" % community)

def _configure_snmp_v3(self, users):
# configure snmp v3 users
Expand Down