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.

Command Line Option

Description

--add

Add a new CMDB sync connection.
tw_sync_control --add --name=Fred42 --endpoint=192.168.1.100 --target-user=gorwell --target-password=1984 --continuous --dataset=BMC.ADDM --datamodel=6

--continuous

Enables continuous synchronization for the specified (--id) connection.

--datamodel=DATAMODEL

Target datamodel number (2-6). See Data models.

--dataset=DATASET

Name of dataset (default = BMC.ADDM).

--disable

Disable the specified (--id) connection.

--enable

Enable the specified (--id) connection.

--endpoint=ENDPOINT

The IP address or hostname of the BMC Atrium CMDB server.

--export-filter

Export filter definition for the specified (--id) connection.

--filter-def=FILE

Specify a filter definition file to write (--export-filter) or read (--import-filter).

--id=TARGET_ID

Specify the identifier or name of the CMDB sync connection. Determine the identifier using the --list option.

--import-filter

Import a filter definition --filter-def for the specified (--id) connection.

--list

Display a list of configured CMDB sync connections, together with the configuration information supplied when the connection was added or last updated

--name=NAME

Specify the name of a connection. Used when adding a new connection.

--not-continuous

Disable continuous sync on the specified (--id) connection.

--no-export

Specify that a new connection should not actually export to a CMDB, but just maintain the local shadow copy of the data within BMC Discovery.

--password=PASSWD

Specifies the password of the BMC Discovery UI user specified using the --username option. If no password is specified, you are prompted for one. For more information about password policies, see Managing security policies.

--passwordfile=PWDFILE

Specifies a file from which the password for the user specified using the --username option is to be read. This is only relevant for actions that require the --username option. This file is not encrypted, though you can set the file permissions to owner-only (chmod 600 passwordfile.txt) to restrict access to the file. For more information about password policies, see Managing security policies.

--pause

Pause synchronization for the specified (--id) connection.

--port=PORT

Port of target server (default = 0). Used with the --endpoint option.

--remove

Remove the specified (--id) connection.

--reset-status

Reset the counts of nodes inserted, updated, and deleted.

--rpc-queue=PORT

RPC queue port of CMDB (default = 0). Used when configuring a private queue.

--status

Show status of all connections, including recently synced devices. The creates, updates, deletes, and errors counts are cumulative

--sync=QUERY

Sync root nodes selected by query.

--target-password=PASSWD

The password of the BMC Atrium CMDB target user specified using the --target-user option.

--target-user=USER

The username for the BMC Atrium CMDB target.

--test-cred

Test credential.

--unpause

Unpause synchronization for the specified (--id) connection.

--update

Update the configuration of the specified (--id) connection.

--username=NAME

The user to run the utility as. This has to be a valid BMC Discovery UI user such as the system user, not a username used to access the command line via ssh.

--workers=WORKERSNumber of concurrent workers (default = 1).

Resync commands

For examples of using these commands, see To resync a connection.

--auto-commitAutomatically commit after the resync prepare stage.
--incremental Perform incremental resync commit.
--resync Initiate resync. That is, perform the prepare and commit stages.

--resync-cancel

Cancel resync on the specified (--id) connection. Cannot be used once a resync has been committed.

--resync-commit

Initiate resync commit on the specified (--id) connection.

--resync-prepareInitiate the resync prepare stage.
--resync-resume Resume interrupted resync.

--resync-status

Show connection resync status.

Data models

CMDB data models are assigned simple integer values:

Data modelCMDB versionsEffect

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

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

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

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 ~]$
Was this page helpful? Yes No Submitting... Thank you

Comments