By default, both containerized and bare metal agents discover all containers. You can change the default behavior in the YAML file to specify which containers to exclude from discovery.

Inclusion and Exclusion Scenarios

The following figure shows example container filtering scenarios for a cluster that has three namespaces:

  • logging
  • monitoring
  • testing
Container filtering scenarios
Use caseInclusionExclusion/th>
Monitor single namespace monitoringnamespace:monitoringnamespace:.*
Monitor everything except namespace loggingnamespace:logging
Do not monitor namespaces monitoring and loggingnamespace:monitoring
namespace:logging
Monitor only one Container with name logger-beta-abcde in namespace loggingcontainer_name:logger-beta-abcdenamespace:logging
Monitor only a single container with image name agentimage_name: agentnamespace:monitoring
namespace:logging
namespace:testing
    or
namespace:.*
Do not monitor containers with name starting with logcontainer_name: log.*
    or
container_name:log
Do not monitor containers with image name starting with logimage_name:log.*
    or
image_name:log

Enable Container Discovery

Container discovery control involves two key parameters: inclusion and exclusion. These parameters accept a single input rule value each, allowing you to specify inclusion and exclusion criteria. The available rule values are:

  • namespace: Applies specifically to Kubernetes and its derivatives. It enables you to include or exclude containers based on their namespace.
  • image_name: Allows you to include or exclude containers based on their image name.
  • container_name: You can Include or exclude containers based on their container name.
KeyDescription
INCLUDE_CONTAINERCriteria for including containers. Example to include container by image name:
    name: INCLUDE_CONTAINER
    value: "image_name:lighttpd2"
                
EXCLUDE_CONTAINERCriteria for excluding containers. Example to exclude containers by namespace:
    name: EXCLUDE_CONTAINER
    value: "namespace:.*"
                

Rule Specification

Rule values have the following general format. You can specify multiple rules, separated by commas. Here are the supported keys:

namespace:<namespace_name1>, namespace:<namespace_name2>, image_name:<image_name1>, image_name:<image_name2>, container_name:<container_name1>, container_name:<container_name2>

You can use regex for inclusion and exclusion values. By default, the string is checked for inclusion, so you don’t need to provide the full string when specifying a value.

Install Virtual Machine Rule Specification

During agent installation, use the following -E and -I options to configure binary. For example:

sudo /opt/opsramp/agent/bin/configure -K T2fTf...4m9c -S UGWjhy...mKPnRuM -s <hostServer> -E "namespace:testing" -I "image_name:lighttpd2"

For a virtual machine these options are in the configuration.properties Misc section. For example:

exclude_container = namespace:.*
include_container = image_name:lighttpd2

Disable Container Discovery

To disable all container discovery, set the disabled variable in the containers env section of the agent YAML file:

name: DISABLE_CONTAINER_DISCOVERY
value: "TRUE"

Inclusion and Exclusion Setting Results


InclusionExclusionResult
Not setNot setAll containers discovered
Some filterNot setAll containers discovered
Not SetSome filterAll containers except those that match the exclusion filter
Some filterSome filterAll containers except those that match the exclusion filter, plus excluded containers that match the inclusion filter