# WARNING: Before making any changes to this file read the following section carefully
#
# After editing the file, make sure the file follows the yml syntax. Common issues include
# - Using tabs instead of spaces
# - File encoding should be UTF-8
#
# The safest way to edit this file is to copy paste the examples provided and make the
# necessary changes using a plain text editor instead of a WYSIWYG editor.
#

# samplingInterval indicates how often to gather metric data. Units in milliseconds.
samplingInterval: 30000

containerMonitoringConfig:
    # containerProcessSelectorRegex defines regular expression to evaluate the processes in
    # each running container to be monitored by the machine agent. The regular expression is
    # compared against each process full command line within running
    # If the pattern matches, then the machine agent start monitoring it.
    #
    # Note : To Monitor Machine agent container
    #               (a) JVM Property: -Dappdynamics.docker.use.monitor.machine.agent.container=true
    #            OR (b) Environment variable: APPDYNAMICS_DOCKER_MONITOR_MACHINE_AGENT_CONTAINER=true
    containerProcessSelectorRegex: ".*"

    # containerNameSelectorRegex defines regular expression to evaluate
    # the container's name to be monitored by the machine agent.
    # The regular expression is compared against each container's name.
    # If the pattern matches, then the machine agent start monitoring it.
    #
    # Note : To Monitor Machine agent container
    #               (a) JVM Property: -Dappdynamics.docker.use.monitor.machine.agent.container=true
    #            OR (b) Environment variable: APPDYNAMICS_DOCKER_MONITOR_MACHINE_AGENT_CONTAINER=true
    # Note: it is used only when
    #               (a) JVM property: -Dappdynamics.docker.use.container.name.selector=true
    #           OR  (b) Environment variable: APPDYNAMICS_DOCKER_USE_CONTAINER_NAME_SELECTOR=true
    containerNameSelectorRegex: ".*"

networkMonitorConfig:
    # blacklistSelectorRegex specifies the regular expression used to blacklist reported networks
    # by name. A network with the name matching the regex will never be reported
    # For example, if one specifies blacklistSelectorRegex: "^(eth1|eth3)$", it will blacklist networks
    # with names that exactly match "eth1" or "eth3".
    blacklistSelectorRegex: "^veth.*|^vnet.*"

processMonitorConfig:
    # enabled indicates if the container process monitoring is enabled
    enabled: true

    # reportingInterval indicates how often to report container processes data. Units in milliseconds.
    reportingInterval: 60000

    # maxClassIdLength specifies the maximum process class name length. Any process
    # class name that is longer than the specified maximum below will be truncated.
    # The global maximum of the process class name is 100. If this variable is set
    # to be greater than 100, then the process name will be truncated at 100.
    maxClassIdLength: 50

    # processSelectorRegex contains a regular expression that selects which
    # docker container processes should be monitored by the machine agent. The regular expression is
    # compared against the full command line that was used to start the process.
    # The default behavior is to monitor all non-kernel processes.
    processSelectorRegex: "^.+[^]]$"

    # minLiveTimeMillisBeforeMonitoring specifies the minimum amount of time a
    # docker container process must be alive before it is monitored by the machine agent. It is
    # useful for preventing the machine agent from being overloaded with monitoring
    # short-lived processes.
    minLiveTimeMillisBeforeMonitoring: 60000

    # maxNumberMonitoredProcesses specifies the maximum number of process that the
    # machine agent will monitor.
    maxNumberMonitoredProcesses: 20

    # When assigning processes to a class, it will be done in the following order:
    # Step #1: the processClassSelectorRegexList is applied if it contains any selectors.
    # Step #2: the defaultProcessClassSelector regular expression, if it is defined,
    #          will extract the process class if it hasn't been done in Step #1.
    # Step #3: If #1 and #2 find nothing, standard classification will be used which is
    #          to use the processName (shortened if needed).
    #
    # To test the effect of any of the above or custom regular expressions, use a
    # command such as: ps -eww -o args | awk -v regex="$REGEX" '$0 ~ regex'

    # processClassSelectorRegexList contains an optional set of class selectors
    # that specify what processes are to be assigned to a defined class name.
    # Each entry specifies a class name and a regular expression.  The regular
    # expression is compared against the full command line.  If there are multiple
    # matching regex, then the first one in the list is used. Any process that
    # matches the expression is assigned to the given process class name.  An
    # example of how to specify the processClassSelectorRegexList is given here:
    #
    # processClassSelectorRegexList :
    #    machineAgentTasks: '.*java.*machineagent.*'
    #    controllerTasks: '.*java.*controller.*'
    #    nextOne:  '.*svchost.*'

    # defaultProcessClassSelector is an optional parameter which will take a regular
    # expression and apply it to the full command line string.  If there is a match
    # found in the command line, it will extract the first group occurrence of the
    # match and use that as the class id.  If left blank or if the expression does
    # not find a match, normal selection is performed.
    defaultProcessClassSelector: ""

    # criticalProcessSelectorRegex specifies a regular expression to identify critical processes
    # that should be monitored by the machine agent. This is useful for ensuring that important
    # processes are monitored regardless of their resource consumption or if they are otherwise
    # excluded from the monitored processes by the Machine Agent.
    #
    # This regular expression is compared against the full command line used to start the process.
    # If a process matches the regex, it will be given higher priority and monitored as a critical process.
    #
    # Examples:
    # 1. "redis|postgres|nginx|mysql|apache2|httpd|java|python|node"
    #    - Mention the process keywords separated by '|'. If any of these keywords are present as a substring
    #      in the full command line of the process, then that process will be considered a critical process
    #      by the Machine Agent.
    # 2. "\b(redis|postgres|nginx|mysql|apache2|httpd|java|python|node)\b"
    #    - If you want to specify the whole word, not just a substring, use the above regex. This ensures that
    #      only exact matches of the process names are considered critical.
    #
    # Note:
    # - Ensure that the regular expression is correctly formatted to avoid any unintended matches.
    # - Regular expressions are case-sensitive by default. If you need case-insensitive matching, consider
    #   using the appropriate regex flags.
    criticalProcessSelectorRegex: ""

    # commandLineTransformers is an optional parameter which allows portions of the process command line matching the
    # given "regex" (regular expression) to be replaced by the given "replaceWith" text. Normally the "regex" may
    # contain multiple groups denoted by round brackets - eg. "(key)=(value)".  To indicate which group should be
    # replaced by the "replaceWith" text it is necessary to define the group number in the "replaceAtGroupNumbers".
    # Defining group 2 and a replaceWith of "***" would result in: "key=***".
    #
    # Example: Mask out all values of command line arguments in the following java process that begin with '-Dfoo.':
    #  java -jar -Dfoo.password=myP@ssW0rd! -Dfoo.secretKey=myS3cr3t#99 -Dagent.max=33 my_application.jar
    # The desired result is:
    #  java -jar -Dfoo.password=*** -Dfoo.secretKey=*** -Dagent.max=33 my_application.jar
    #
    # To achieve the desired results, the following parameters should be defined:
    # commandLineTransformers         :
    #  - regex: "(-Dfoo\\.[^\\=]+)=([^\\s]+)"
    #    replaceAtGroupNumbers:
    #    - 2
    #    replaceWith: "***"
    #
    # Since we have defined 2 for the replaceAtGroupNumbers, this means that the first group defined in the round
    # brackets is only used to search for the portion that will be replaced and the second group (i.e. 2) in the
    # second set of round brackets will determine the portion that will be replaced by the replaceWith text.
    #
    # Here's a breakdown of the regex expression used above: '(-Dfoo\\.[^\\=]+)=([^\\s]+)'
    # The first group '(-Dfoo\\.[^\\=]+)' means: match anything starting with the literal characters '-Dfoo.'
    #  followed by any character that is not the equals sign (i.e. '^\\=' means NOT equals character),
    #  and the '+' sign means match one or more such characters.
    #  Note that in order to use a literal dot character '.', it must be escaped with backslash: '\\.' (i.e.
    #   define as '-Dfoo\\.' to mean '-Dfoo.'
    # The next part of the regex above is just the literal '=' character in between the two groups.
    # The second group '([^\\s]+)' means match any character that is not the space character (i.e. '^\\s'),
    #  and the + sign means match one or more such characters. This effectively matches all characters after the equals
    #  sign up till the next space character as the second group - this is the portion that will be masked out.
    # Note: when using regular expression tools such as regex101.com use single backslash: (-Dfoo\.[^\=]+)=([^\s]+)
    #
    # To replace values for ALL command line args, use the following:
    # commandLineTransformers         :
    # - regex: "(-D[^\\=]+)=([^\\s]+)"
    #   replaceAtGroupNumbers:
    #   - 2
    #   replaceWith: "***"
