Importing and Exporting Test and Monitor Templates
Templates for tests and monitors can be exported from one installation of Control Center and imported into another (or into a different account on the same Control Center). The following commands are used for this purpose:
ncc template
for testsncc monitor-template
for monitors
The syntax is identical for these two commands and is detailed below for ncc
template
.
Listing Templates
To list all templates with account name, template name and ID, give this command:
ncc template list [--account NAME]
Use the --account
flag to list templates from a specific account only.
Exporting Templates
Use this command to export template configurations in JSON format:
ncc template export [--account NAME] [--file NAME] [id ...]
Here, [id ...]
is a list of IDs of the templates you want to export. If no
template IDs are specified, all templates are exported.
The --file
flag specifies the name of the output file. If you omit this,
the output will be written to stdout.
Use the --account
flag to filter templates by account.
Importing Templates
On exporting templates, you can import them to a specified account as follows:
ncc template import --account NAME [--force_overwrite] [export file name]
Here, export file name
is an output file obtained from ncc
template export
. (If no file is specified, the import command reads from
stdin.)
If the force_overwrite
flag is set, then any templates with the same name
that already exist in the account will be overwritten. Using this option is not
recommended in general. It is preferable to rename the existing template(s) before
importing.
Usage Examples
-
Export a single template named "template1":
ncc template export template1 --file my_template.json
-
Export all templates from account "demo":
ncc template export --account demo --file all_demo_templates.json
-
Export all templates on the server:
ncc template export --file all_templates.json
-
Import templates from export file to account "demo":
ncc template import --account demo all_demo_templates.json