DataDog / integrations-core

Core integrations of the Datadog Agent
BSD 3-Clause "New" or "Revised" License
932 stars 1.4k forks source link

MongoDB 4.4 check initialization error. #10011

Closed vrecluse closed 3 years ago

vrecluse commented 3 years ago

Output of the info page

Check Initialization Errors
mongo (2.5.0)
Instance 0
could not invoke 'mongo' python check constructor. New constructor API returned:
Traceback (most recent call last):
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\mongo.py", line 70, in __init__
      self._config = MongoConfig(self.instance, self.log)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\config.py", line 49, in __init__
      self.clean_server_name = self._get_clean_server_name()
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\config.py", line 81, in _get_clean_server_name
      server = build_connection_string(
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\utils.py", line 21, in build_connection_string
      netloc = '{}:{}@{}'.format(quote_plus(username), quote_plus(password), host)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\urllib\parse.py", line 867, in quote_plus
      string = quote(string, safe + space, encoding, errors)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\urllib\parse.py", line 851, in quote
      return quote_from_bytes(string, safe)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\urllib\parse.py", line 876, in quote_from_bytes
      raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes
Deprecated constructor API returned:
__init__() got an unexpected keyword argument 'agentConfig'
Loading Errors
mongo
Core Check Loader: Check mongo not found in Catalog
JMX Check Loader: check is not a jmx check, or unable to determine if it's so
Python Check Loader: could not configure check instance for python check mongo: could not invoke 'mongo' python check constructor. New constructor API returned:
Traceback (most recent call last):
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\mongo.py", line 70, in __init__
      self._config = MongoConfig(self.instance, self.log)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\config.py", line 49, in __init__
      self.clean_server_name = self._get_clean_server_name()
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\config.py", line 81, in _get_clean_server_name
      server = build_connection_string(
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\site-packages\datadog_checks\mongo\utils.py", line 21, in build_connection_string
      netloc = '{}:{}@{}'.format(quote_plus(username), quote_plus(password), host)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\urllib\parse.py", line 867, in quote_plus
      string = quote(string, safe + space, encoding, errors)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\urllib\parse.py", line 851, in quote
      return quote_from_bytes(string, safe)
   File "C:\Program Files\Datadog\Datadog Agent\embedded3\lib\urllib\parse.py", line 876, in quote_from_bytes
      raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes

config:

## All options defined here are available to all instances.
#
init_config:

    ## @param service - string - optional
    ## Attach the tag `service:<SERVICE>` to every metric, event, and service check emitted by this integration.
    ##
    ## Additionally, this sets the default `service` for every log source.
    #
    # service: <SERVICE>

## Every instance is scheduled independent of the others.
#
instances:

    ## @param hosts - list of strings - required
    ## The host (and optional port number) where the mongod instance (or mongos instances for
    ## a sharded cluster) is running. You can specify a hostname, IP address, or UNIX domain
    ## socket. Specify as many hosts as appropriate for your deployment topology:
    ##
    ##   - For a standalone, specify the hostname of the standalone mongod instance.
    ##   - For a replica set, specify the hostname of a mongod instance as listed in
    ##     the replica set configuration. You need one check instance per mongod instance
    ##     in order to collect replication metrics and events.
    ##   - For a sharded cluster, you need one check instance for each mongod instance in
    ##     each shard (including the configsvr shard) as well as one additional check instance
    ##     that connects to one (or more) mongos node.
    ##
    ## If the port number is not specified, the default port 27017 is used.
    ##
    ## Even if the host is an arbiter node, you still need to provide authentication credentials
    ## as the check will create an additional connection to the primary in this specific case.
    ##
    ## Do not specify more than one host here unless you are connecting to a mongos instance
    ## and you want to balance requests performed by the agent to multiple mongos instances.
    #
  - hosts:
      - localhost

    ## @param username - string - optional
    ## The username to use for authentication.
    #
    username: datadog

    ## @param password - string - optional
    ## The password to use for authentication.
    #
    password: 123456

Additional environment details (Operating System, Cloud provider, etc):

Steps to reproduce the issue:

  1. Init mongodb datadog user
  2. Modify mongo.d/conf.yaml
  3. Restart datadog
vrecluse commented 3 years ago

My bad, password should be string.