Backing up and restoring UI topology configuration data

Topology management includes a backup facility, which lets you backup UI topology configuration settings such as user preferences, topology tools, custom icons, relationship types, rules, and advanced topology settings.

About this task

The UI configuration data is stored in the Cassandra database and therefore backed up with the rest of the data, as described in the backup and restore topics. However, using the following procedure, you can test UI customizations in a staging environment, before exporting them back into the production environment.
Limitation: File observer files and trusted certificates are not included in the backup of observer jobs. Restore or copy these manually, or else affected jobs will not run once restored.
When to export configuration data
Topology management UI configuration settings are stored in the topology service database. If that database is deleted, the configuration settings are also deleted. You may therefore want to create a backup of configuration data if you intend to conduct testing that may involve changes to your database. After installing or rebuilding a new database, you can then restore the configuration data.
You can export configuration data as part of your data protection strategy, to provide a backup in case of data corruption or accidental data deletion.
You can export configuration data from a staging system in order to then import it into a live system.
Export parameters
All parameters are optional.
Note: You can run the backup_ui_config command without setting any parameters. If you do, all Agile Service Manager UI configuration settings will be exported to the following default file: $ASM_HOME/data/tools/asm_ui_config.txt
config
The -config flag allows the type of configuration you want to export to be specified.
By default all UI configuration settings are backed up.
Restriction: Only one config option can be specified during backup. Do not run the backup_ui_config command with the -config all option. You can use any one of the parameters specified, but only one at a time.
Settings for -config <config_type>
Backs up the following Agile Service Manager UI configuration settings
tools
Topology tools definitions
icons
Custom icon definitions
types
Resource type definitions
edges
Edge type definitions
links
Relationship type definitions
rules
Rule definitions
preferences
User preferences
settings
Advanced topology settings
criticality
Business criticality definitions
templates
Resource group template definitions
jobs
Observer job definitions
plainpassword
When exporting observer job definitions, use this parameter to export the passwords as plain text.
Important: This parameter is for development environments only. For production environments, ensure that the encryption keys for observer job passwords between the source and target system match. For more information, see the Changing encryption keys and passwords external icon topic in the Agile Service Manager documentation.
out
The -out flag is the name of the backup file name to create.
The name must be a file name only, with no directory paths.
The default output file name is asm_ui_config.txt, and the output location is fixed as $ASM_HOME/data/tools.
Note: If the file already exists, the tool will indicate this and quit. For the existing file to be overwritten with new output, use the -force parameter.
force
If you set the -force parameter, the tool overwrites an existing output file with new content.
verbose
The -verbose flag runs the tool in verbose mode, whereby extra log messages are printed to the shell during execution.
This parameter is useful if a problem occurs while running the tool, and you want to re-run it with extra information made available.
Import parameters
file
The -file parameter is the name of the backup file from which to import definitions. It must be a file name only with no directory paths included, and it must exist in the tools data directory ($ASM_HOME/data/tools).
overwrite
By default, as the import tool reads the backup file it looks up each item in the topology service to see if it already exists. Any configuration definitions which already exist are not updated.
However, if you set the -overwrite flag, the existing definitions are overwritten with the values from the backup file.
verbose
The -verbose flag runs the tool in verbose mode, whereby extra log messages are printed to the shell during execution.
Useful if a problem occurs running the tool and you want to re-run it with extra information made available.
Restriction:
  • Jobs are not imported into systems where the observer has not been installed.
  • Jobs are not imported into systems where the observer job already exists (that is, where a job with the same name exists for the same observer).
  • Jobs are imported but cannot run if the encryption key on both source and target system don't match. For more information, see the Changing encryption keys and passwords external icon topic in the Agile Service Manager documentation.

Procedure

  1. Find the name of the topology pod, as in the following example:
    oc get pods |grep topology-topology
    NAME                            READY     STATUS    RESTARTS   AGE
    noi-topology-topology-577dc5497b-2wbxk   1/1       Running   0          12h
  2. Run the backup tool (backup_ui_config).
    usage: backup_ui_config [-config <config_type>] [-out <output_filename>] [-plainpassword] [-force] [-verbose]
    
    where 'config-type' can be set to one of the following:
    
    all         - backup all ASM UI configuration (default)
    tools       - backup topology tools definitions
    icons       - backup custom icon definitions
    types       - backup resource type definitions
    edges       - backup edge type definitions
    links       - backup relationship type definitions
    rules       - backup rule definitions
    preferences - backup user preferences
    settings    - backup advanced settings
    criticality - backup business criticality definitions
    jobs        - backup observer job definitions
    templates   - backup resource group templates
    
    Example: The following example backs up the rule definitions:
    kubectl exec -ti noi-507-topology-topology-688d44474-t2m5c -- /opt/ibm/graph.tools/bin/backup_ui_config -config rules -out rules_19122022.json
    Defaulted container "noi-507-topology-topology" out of: noi-507-topology-topology, wait-for-cassandra (init), wait-for-kafka (init)
    INFO    : Topology Service REST host detected: localhost:8080
    INFO    : Topology Service tenant ID detected: cfd95b7e-3bc7-4006-a4a8-a73a79c71255
    INFO    : Backing up merge rule: dockerId
    INFO    : Backing up merge rule: aaiFileHpnfvdSdcWriterule
    INFO    : Backing up merge rule: merge-ip
    INFO    : Backing up merge rule: almExternalId
    INFO    : Backing up merge rule: dockerFromJenkins
    INFO    : Backing up merge rule: merge-host
    INFO    : Backing up match tokens rule: as-match-token-season
    INFO    : Backing up match tokens rule: itnmInterfaceTokens
    INFO    : Backing up match tokens rule: k8ServiceName
    INFO    : Backing up match tokens rule: itnmHostCardTokens
    INFO    : Backing up match tokens rule: gitlabResourceToken
    INFO    : Backing up match tokens rule: itnmIPTokens
    INFO    : Backing up match tokens rule: itnmNetworkTokens
    INFO    : Backing up match tokens rule: itnmGenericTokens
    INFO    : Backing up match tokens rule: sevoneHostTokens
    INFO    : Backing up tags rule: as-tag-rule-1
    INFO    : Backing up tags rule: gitlabResourceTag
    INFO    : Backing up tags rule: hpnfvdResourceTag
    INFO    : Backing up tags rule: vnfTypeTag
    INFO    : No history rule definitions were found
    INFO    : Backing up events filter rule: event-filter-jenkins-build
    INFO    : Backing up events filter rule: event-filter-awx-job
    INFO    : No business criticality rule definitions were found
    INFO    : Output file has been created: /opt/ibm/netcool/asm/data/tools/rules_19122022.json
    
    Program complete.
    
    To copy the resulting backup file from the container for storage elsewhere
    kubectl cp noi-507-topology-topology-688d44474-t2m5c:/opt/ibm/netcool/asm/data/tools/rules_19122022.json /tmp/backups/19122022/rules_19122022.json
  3. To save a copy of your backup, copy the file out of the topology container using the kubectl cp command.
    For example:
    $ kubectl cp noi-topology-topology-577dc5497b-2wbxk:/opt/ibm/netcool/asm/data/tools/backup-20180908.json /tmp/backup-20180809.json
     $ find /tmp/backup*
     /tmp/backup-20180809.json
  4. To import files, copy them into the /opt/ibm/netcool/asm/data/tools location inside the container:
    $ kubectl cp /tmp/backup-20180809.json noi-topology-topology-577dc5497b-2wbxk:/opt/ibm/netcool/asm/data/tools/backup-20180909.json 
     $ kubectl exec -ti noi-topology-topology-577dc5497b-2wbxk -- find /opt/ibm/netcool/asm/data/tools/
     /opt/ibm/netcool/asm/data/tools/backup-20180908.json
     /opt/ibm/netcool/asm/data/tools/backup-20180909.json
  5. Run the import tool, as in the following example:
    $ kubectl exec -ti noi-topology-topology-577dc5497b-2wbxk -- /opt/ibm/graph.tools/bin/import_ui_config -file backup-20180908.json -overwrite 
     INFO  : Topology Service REST host detected: localhost:8080 
     INFO  : Topology Service tenant ID detected: cfd95b7e-3bc7-4006-a4a8-a73a79c71255 
     INFO  : Skipping import of entity type because it matches the existing definition: container 
     INFO  : Skipping import of entity type because it matches the existing definition: cpu 
     INFO  : Skipping import of entity type because it matches the existing definition: deployment 
     INFO  : Skipping import of entity type because it matches the existing definition: image 
     INFO  : Skipping import of entity type because it matches the existing definition: networkinterface 
     INFO  : Skipping import of entity type because it matches the existing definition: psu 
     INFO  : Skipping import of entity type because it matches the existing definition: router 
     INFO  : Skipping import of entity type because it matches the existing definition: sensor 
     INFO  : Skipping import of entity type because it matches the existing definition: server 
     INFO  : Skipping import of entity type because it matches the existing definition: service 
     INFO  : Skipping import of entity type because it matches the existing definition: subnet 
     INFO  : Skipping import of entity type because it matches the existing definition: switch 
     INFO  : Skipping import of entity type because it matches the existing definition: vlan 
     INFO  : Skipping import of entity type because it matches the existing definition: vpn 
    
     Program complete.