Search

4.6. Extended Example: Drift Monitoring

download PDF
Drift monitoring is allowed for a resource by defining a default drift definition in the plug-in. In the plug-in configuration, the drift definition creates a default template that indicates that a resource supports drift monitoring. (Additional templates can be created by users or the default template can be revised when it is applied to a resource.)
At its most basic, the drift definition sets a target location for the drift system to monitor. This location can be identified from several different configuration areas for the resource:
  • fileSystem, which is any directory on the machine local to the resource
  • pluginConfiguration, which is defined property in the resource plug-in, like a home directory
  • resourceConfiguration, a resource configuration property
  • measurementTrait, a trait that is gathered about the resource
This target location is the base directory. The element which identifies where to find the value for the base directory the value name, while the actual value is the context. For example, for a base directory of /etc/, the elements in the drift definition are:
Value name: fileSystem
Value context: /etc
The most basic drift definition only needs to define the value name and context.

Example 4.23. Base Directory Only

     <drift-definition name="Template-File System"   
                       description="Monitor the file system for drift. Definitions should set a more specific base directory as the file system root is not recommended.">  
         <basedir>  
             <value-context>fileSystem</value-context>  
             <value-name>/</value-name>  
         </basedir>  
     </drift-definition>
It is possible to set more information, like subdirectories or file types which should be explicitly included or excluded. These are additional paths, beneath the base directory, and file types can be identified by patterns.
If a directory or file type is explicitly included, then all other files and directories are implicitly excluded (and vice versa, if something is explicitly excluded, everything else is implicitly included). There can be multiple paths and patterns defined.

Example 4.24. Included Paths and Patterns

<drift-definition name="Template-Base Files"
                  description="Monitor base application server files for drift. It defines monitoring for some standard sub-directories of the HOME directory.  Note, it is not recommeded to monitor all files for an application server. There are many files, and many temp files.">
    <basedir>
         <value-context>pluginConfiguration</value-context>
         <value-name>homeDir</value-name>
    </basedir>
    <includes>
	<include path="bin" pattern="*/*.sh" />
        <include path="lib" />
        <include path="client" />
    </includes>
</drift-definition>
NOTE
Multiple drift definitions can be defined for a resource type, but each drift definition defined only a single base directory to monitor for drift.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.