This documentation supports the 20.08 (12.1) version of BMC Discovery.To view an earlier version of the product, select the version from the Product version menu.

tw_sync_control


The tw_sync_control utility enables you to control CMDB sync activities from the command line. The utility is primarily intended to be used as a means of automating certain CMDB sync procedures rather than an all purpose controller for CMDB sync. To use the utility, type the following command:

tw_sync_control [options]

where options are any of the options described in the following table and the common command line options described in Using-command-line-utilities.

Common password options are described in this table

Common password options are described in this table to make it clear whether the password referred to is for the local or remote system.

Data models

CMDB data models are assigned simple integer values:

Data model

CMDB versions

Effect

6

7.6.03 and later

HasImpact and ImpactDirection attributes are set as appropriate.

5

7.6.03 and later

Only to be used with legacy SIM version 7.4. BMC_Impact relationships with Name “ImpactOnly” are created.

4

7.6.03 and later

No impact details are set by BMC Discovery. They may be set by Impact Normalization in the CMDB.

3

7.6 before 7.6.03

BMC_Impact relationships with name “IMPACT” are created.

2

7.5

BMC_Impact relationships with name “IMPACT” are created.

User examples

To modify an existing connection

You can modify the configuration of an existing CMDB connection using the --update option:

[tideway@appliance01 ~]$ tw_sync_control --update
--id 2d104b55361df7974e4d1bf86e434d444253796e63436f6e666967 --username=system --name 8102_4
Password:
Target successfully updated:

          Id: 2d104b55361df7974e4d1bf86e434d444253796e63436f6e666967
        Name: 8102_4
        Type: CMDB
    Endpoint: <IP address>
        User: Demo
     Dataset: John_4
   Datamodel: CMDB 7.6.03 and later (with impact attributes)
  Continuous: False


[tideway@appliance01 ~]$

The most likely usage of the tw_sync_control utility is to automate regular synchronization of an existing CMDB connection using cron updated with tw_cron_update. The following command is modified to use a password file and a query for the same connection:

[tideway@appliance01 ~]$ tw_sync_control
--id 2d104b55361df7974e4d1bf86e434d444253796e63436f6e666967 --username=system
--passwordfile=/usr/tideway/etc/passwd.txt --sync="search Host where name has subword 'example'"

The automation requires the command to be entered into a .cron file in the /usr/tideway/etc/cron directory. In this example, tw_sync_control.cron.

[tideway@appliance01 ~]$ cd etc/cron
[tideway@appliance01 cron]$ ls
tw_appliance_stats.cron  tw_compress_logs.cron  tw_cron.header  
tw_cron.previous  tw_log_performance.cron  tw_sync_control.cron
[tideway@appliance01 cron]$ more tw_sync_control.cron
#
# cron job to sync Windows hosts
# runs every day at 01:00
#
0 1 * * * /usr/tideway/bin/tw_sync_control
--id 2d104b55361df7974e4d1bf86e434d444253796e63436f6e666967 --username=system
--passwordfile=/usr/tideway/etc/passwd.txt --sync="search Host where name has subword 'example'"
[tideway@appliance01 cron]$

To determine connection information

Click here to expand...

To determine the IDs of current connections

You use the connection ID to specify the particular connection on which to perform sync operations. To determine this:

[tideway@appliance01 ~]$ tw_sync_control --list --username=system
Password:
Sync targets:

          Id: 2d104b55361df7974e4d1bf86e434d444253796e63436f6e666967
        Name: 8102_4
        Type: CMDB
    Endpoint: <IP address>
        User: Demo
     Dataset: John_4
   Datamodel: CMDB 7.6.03 and later (with impact attributes)
Multitenancy: False
              Available :
  Continuous: False
   Blackouts: 0 blackout windows

          Id: 1b384a55302402bf596e8d226e434d444253796e63436f6e666967
        Name: ValidIP_SyncIP
        Type: CMDB
    Endpoint: <IP address>
        User: Demo
     Dataset: mltest
   Datamodel: CMDB 7.6.03 and later (with impact attributes)
Multitenancy: False
              Available : Built In-House, Calbro Services, Invention, Inc.
  Continuous: False
   Blackouts: 0 blackout windows


[tideway@appliance01 ~]$

To determine the status of a particular connection

To obtain the detailed status on a connection you must use the connection ID reported when using the --list option, described above.

[tideway@appliance01 ~]$ tw_sync_control --status
--id=1b384a55302402bf596e8d226e434d444253796e63436f6e666967 --user=system
Password:
Sync target status at 2015-05-07 16:13:31

            Id: 1b384a55302402bf596e8d226e434d444253796e63436f6e666967
          Name: ValidIP_SyncIP
        Server: Verifying connection...
         State: ENABLED
        Resync: Unknown
    Continuous: False
    Queue Size: 0
 Device Counts: 0 Created, 0 Updated, 0 Deleted
   Error Count: 0


[tideway@appliance01 ~]$

Basic operations on a connection

Click here to expand...

To pause or unpause a particular connection

To pause or unpause a connection you must use the connection ID reported when using the --list option, described above.

[tideway@appliance01 ~]$ tw_sync_control --pause
--id=1b384a55302402bf596e8d226e434d444253796e63436f6e666967 --username=system
Password:
Successfully paused sync target
[tideway@appliance01 ~]$ tw_sync_control --unpause
--id=1b384a55302402bf596e8d226e434d444253796e63436f6e666967 --username=system                               
Password:
Successfully unpaused sync target
[tideway@appliance01 ~]$

To enable or disable a connection

To enable or disable a connection you must use the connection ID reported when using the --list option, described above.

[tideway@appliance01 ~]$ tw_sync_control --disable
--id=1b384a55302402bf596e8d226e434d444253796e63436f6e666967 --username=system
Password:
Successfully disabled sync target
[tideway@appliance01 ~]$ tw_sync_control --enable
--id=1b384a55302402bf596e8d226e434d444253796e63436f6e666967 --username=system
Password:
Successfully enabled sync target
[tideway@appliance01 ~]$

To resync a connection

Click here to expand...

To do a resync prepare and commit

[tideway@appliance01 ~]$ tw_sync_control --id cmdb01 --resync
Successfully initiated resync

To cancel a resync that is in progress

[tideway@appliance01 ~]$ tw_sync_control --id cmdb01 --resync-cancel
Successfully cancelled resync
[tideway@appliance01 ~]$

To resume an incomplete resync and commit

[tideway@appliance01 ~]$ tw_sync_control --id cmdb01 --resync-resume  --auto-commit
Successfully resumed resync
[tideway@appliance01 ~]$

To resume an incomplete resync and incremental commit

[tideway@appliance01 ~]$ tw_sync_control --id cmdb01 --resync-resume  --auto-commit --incremental
Successfully resumed resync
[tideway@appliance01 ~]$

To see status of resync

[tideway@appliance01 ~]$ tw_sync_control --id cmdb01 --resync-status
Resync Status
Id: f6d0f43479a58cc937e20a31122c5958
 Status: RUNNING
 Tasks:
 Retrieve Dataset Data
 COMPLETED
 Retrieved 9543 CIs (23 duplicates), 14466 relationships (30 duplicates) (duration 0:00:02)
Update Sync Partition
 COMPLETED
 Processed 0 devices
Evaluate Differences
 RUNNING
 Differencing BMC_Dependency relationships (0 of 2413)
...

 

To prepare a resync prepare without any commit

[tideway@appliance01 ~]$ tw_sync_control --id cmdb01 --resync-prepare
Successfully initiated resync prepare
[tideway@appliance01 ~]$

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*