Configuring drift detection

Configure the drift detection feature to specify which configuration parameters to monitor, define the inventory of servers, and set up comparison rules.

Before you begin

Before you begin, ensure that you installed the configuration drift detection feature. For more information, see Installing configuration drift detection.

About this task

Configuration involves setting up query flags to control which configuration parameters are collected, defining the server inventory, and configuring comparison rules for drift detection.

Procedure

To configure drift detection, complete the following steps:

  1. Create a variables file (vars.yml) to configure fact collection flags:
    sp_server_facts_flags:
      q_status: true
      q_monitorsettings: true
      q_db: true
      q_dbspace: true
      q_log: true
      q_domain: true
      q_copygroup: true
      q_replrule: true
      q_devclass: true
      q_mgmtclass: true
      q_stgpool: true

    Each flag enables a specific query module. Set flags to true to enable collection or false to disable. For more information about available flags, see Drift detection query flags and configuration coverage.

  2. Create an inventory file (inventory.ini) to define the IBM Storage Protect servers to monitor:
    Configuration Example
    Single host
    [sp_servers]
    sp-server-01 ansible_host=10.0.1.10
    
    [sp_servers:vars]
    ansible_user=admin
    ansible_connection=ssh
    Multiple hosts
    [sp_servers]
    v1 ansible_host=10.0.0.11
    v2 ansible_host=10.0.0.12
    v3 ansible_host=10.0.0.13
    
    [sp_servers:vars]
    ansible_user=your_user
    ansible_connection=ssh
  3. (Optional) Configure drift detection parameters:
    1. Configure ignore keys to exclude volatile fields from drift comparison:

      When you run the drift comparison script, you can specify keys to ignore:

      python3 scripts/sp_config_diff.py baseline.json current.json \
        --out diff_report.json \
        --ignore-keys timestamp,last_checked,scan_id

      Common volatile keys to ignore include timestamps, scan identifiers, and frequently changing counters.

    2. Configure normalization rules for data comparison:

      Normalization rules ensure consistent data comparison across snapshots:

      • Unit rules: Normalize sizes to KB and timestamps to UTC
      • List ID keys: Define identifier fields for list matching (for example, nodes by name)
      • Severity rules: Map configuration changes to severity levels
      Tip: Normalization rules are applied automatically during drift comparison to ensure accurate detection of configuration changes.
  4. Test the configuration by running a test query:
    ansible-playbook -i inventory.ini \
      ibm.storage_protect.sp_server_facts_playbook.yml \
      -e @vars.yml --check
    The check mode validates the configuration without making changes.

Results

After completing these steps, the drift detection feature is configured with the specified query flags, server inventory, and comparison rules.

What to do next

After configuration, run the drift detection playbook to generate baseline snapshots and detect configuration drift. For more information, see Running configuration drift detection.