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:
where options are any of the options described in the following table and the common command line options described in Using-command-line-utilities.
Command Line Option | Description |
---|---|
--add | Add a new CMDB sync connection. |
--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=WORKERS | Number of concurrent workers (default = 1). |
Resync commands | For examples of using these commands, see To resync a connection. |
--auto-commit | Automatically 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-prepare | Initiate 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 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:
--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:
--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 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
Basic operations on a connection
To resync a connection