diff --git a/splunk_connect_for_snmp_poller/mongo.py b/splunk_connect_for_snmp_poller/mongo.py index 89f3a0f..8fd62e9 100644 --- a/splunk_connect_for_snmp_poller/mongo.py +++ b/splunk_connect_for_snmp_poller/mongo.py @@ -9,6 +9,13 @@ def __init__(self, mongo_config): os.environ["MONGO_SERVICE_SERVICE_HOST"], int(os.environ["MONGO_SERVICE_SERVICE_PORT"]), ) + if os.environ.get("MONGO_USER"): + self._client.admin.authenticate( + os.environ["MONGO_USER"], + os.environ["MONGO_PASS"], + mechanism="SCRAM-SHA-1", + ) + self._walked_hosts = self._client[mongo_config["database"]][ mongo_config["collection"] ]