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 use cases

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

  • logging
  • monitoring
  • testing
Container filtering scenarios

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
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
Do not monitor containers with name starting with logcontainer_name: log.*
Do not monitor containers with image name starting with logimage_name:log.*

Enable Container Discovery

Two keys control container inclusion or exclusion:

INCLUDE_CONTAINERCriteria for including containers. Example to include container by image name:
    value: "image_name:lighttpd2"
EXCLUDE_CONTAINERCriteria for excluding containers. Example to exclude containers by namespace:
    value: "namespace:.*"

Both keys accept one of the following single input rule values for specifying inclusion and exclusion:

  • namespace, which applies only to Kubernetes and its spins
  • image_name
  • container_name

Rule specification

Rule values have the following general format:

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

Rules are comma-delimited and must be key:value pairs.

Regex is supported when specifying inclusion and exclusion values. By default, the string is checked for containing the value so the full string does not need to be provided when specifying a value.

Install and virtual machine rule specification

During agent installation, use the following -E and -I options to the 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 Misc section. For example:

exclude_container = namespace:.*
include_container = image_name:lighttpd2

Disable Container Discovery

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

value: "TRUE"

Inclusion and exclusion setting results

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