Template
add_template_to_group
Add templates to groups.
NOTE: Group arguments are interpreted as template groups in >= 6.2, otherwise as host groups.
Arguments
TEMPLATE_NAMES_OR_IDS
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
GROUP_NAMES_OR_IDS
Host/template group names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
Options
--strict
Fail if any host groups or templates aren't found. Should not be used in conjunction with wildcards.
Type: boolean
(flag)
Default: False
create_templategroup
Create a new template group.
Assigns permissions for user groups defined in configuration file if no user groups are specified.
--rw-groups uses the default admin user groups if not specified. --ro-groups uses the default create user groups if not specified.
Use --no-usergroup-permissions to create a group without assigning user group permissions.
NOTE: Calls create_hostgroup
for Zabbix versions < 6.2.0.
Examples
Create a template group with default user group permissions
Create a template group with specific RO and RW groups
Create a template group with no user group permissions
Arguments
TEMPLATEGROUP
Name of the group.
Type: text
Required: ✅
Options
--rw-groups
<RW_GROUPS>
User group(s) to give read/write permissions. Comma-separated.
Type: text
--ro-groups
<RO_GROUPS>
User group(s) to give read-only permissions. Comma-separated.
Type: text
--no-usergroup-permissions
Do not assign user group permissions.
Type: boolean
(flag)
Default: False
extend_templategroup
Add all templates from a group to other groups.
Interprets the source group as a template group in >= 6.2, otherwise as a host group.
Does not modify the source group or its templates.
To remove the templates from the source group, use the move_templates
command instead.
Arguments
SRC_GROUP
Group to get templates from.
Type: text
Required: ✅
DEST_GROUP
Group(s) to add templates to. Comma-separated. Supports wildcards.
Type: text
Required: ✅
Options
--dryrun
Show groups and templates without copying.
Type: boolean
(flag)
Default: False
link_template_to_host
Link templates to hosts.
Examples
Link one template to one host
Link many templates to many hosts
Link one template to all hosts
Link many templates to all hosts
Link all templates to all hosts (use with caution!)
Arguments
TEMPLATE_NAMES_OR_IDS
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
HOSTNAMES_OR_IDS
Hostnames or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
Options
--strict
Fail if any hosts or templates aren't found. Should not be used in conjunction with wildcards.
Type: boolean
(flag)
Default: False
--dryrun
Preview changes.
Type: boolean
(flag)
Default: False
link_template_to_template
Link templates to templates.
NOTE: Destination templates are the ones that are ultimately modified. Source templates remain unchanged.
Examples
Link one template to one template
Link many templates to many templates
Link all templates starting with 'Apache' to a template
Link all templates containing 'HTTP' to a subset of templates
Arguments
SOURCE
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
DEST
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
Options
--strict
Fail if any templates aren't found. Should not be used in conjunction with wildcards.
Type: boolean
(flag)
Default: False
--dryrun
Do not actually link templates, just show what would be done.
Type: boolean
(flag)
Default: False
move_templates
Move all templates from one group to another.
Arguments
SRC_GROUP
Group to move templates from.
Type: text
Required: ✅
DEST_GROUP
Group to move templates to.
Type: text
Required: ✅
Options
--rollback
/--no-rollback
Rollback changes if templates cannot be removed from source group afterwards.
Type: boolean
(flag)
Default: True
--dryrun
Show templates and groups without making changes.
Type: boolean
(flag)
Default: False
remove_template_from_group
Remove templates from groups.
Examples
Remove one template from one group
Remove many templates from many groups
Remove all templates starting with 'Apache' from a group
Remove all templates containing 'HTTP' from all groups
Arguments
TEMPLATE_NAMES_OR_IDS
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
GROUP_NAMES_OR_IDS
Host/template group names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
Options
--strict
Fail if any host groups or templates aren't found. Should not be used in conjunction with wildcards.
Type: boolean
(flag)
Default: False
--dryrun
Preview changes.
Type: boolean
(flag)
Default: False
remove_templategroup
Delete a template group.
NOTE: Calls remove_hostgroup
for Zabbix <6.2.
Arguments
TEMPLATEGROUP
Name of the group to delete.
Type: text
Required: ✅
show_items
Show a template's items.
Examples
Show items for a template
Arguments
TEMPLATE_NAME
Template name or ID. Supports wildcards.
Type: text
Required: ✅
show_template
Show a template.
Arguments
TEMPLATE_NAME
Template name or ID. Names support wildcards.
Type: text
Required: ✅
show_templategroup
Show details for a template group.
Arguments
TEMPLATEGROUP
Name of the group to show. Supports wildcards.
Type: text
Required: ✅
Options
--templates
/--no-templates
Show/hide templates associated with the group.
Type: boolean
(flag)
Default: True
show_templategroups
Show template groups.
Fetches all groups by default, but can be filtered by name.
Examples
Show all template groups
Show all template groups starting with 'Web-'
Show template groups with 'web' in the name
Arguments
NAME
Name of template group(s). Comma-separated. Supports wildcards.
Type: text
Options
--templates
/--no-templates
Show/hide templates associated with each group.
Type: boolean
(flag)
Default: True
show_templates
Show one or more templates.
Shows all templates by default. The template name can be a pattern containing wildcards. Names and IDs cannot be mixed.
Arguments
TEMPLATES
Template name(s) or ID(s). Comma-separated. Supports wildcards.
Type: text
Default: *
unlink_template_from_host
Unlink templates from hosts.
Unlinks and clears by default. Use --no-clear
to unlink without clearing.
Examples
Unlink a template from a host
Unlink many templates from many hosts
Unlink one template from all hosts
Unlink templates starting with 'Apache' from hosts starting with 'Web'
Unlink template from host without clearing items and triggers
Arguments
TEMPLATE_NAMES_OR_IDS
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
HOSTNAMES_OR_IDS
Hostnames or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
Options
--strict
Fail if any hosts or templates aren't found. Should not be used in conjunction with wildcards.
Type: boolean
(flag)
Default: False
--dryrun
Preview changes.
Type: boolean
(flag)
Default: False
--clear
/--no-clear
Unlink and clear templates.
Type: boolean
(flag)
Default: True
unlink_template_from_template
Unlink templates from templates.
Unlinks and clears by default. Use --no-clear
to unlink without clearing.
NOTE: Destination templates are the ones that are ultimately modified. Source templates remain unchanged.
Examples
Unlink one template from one template
Unlink many templates from many templates
Unlink all templates starting with 'Apache' from a template
Unlink all templates containing 'HTTP' from a subset of templates
Unlink a template without clearing items and triggers
Arguments
SOURCE
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
DEST
Template names or IDs. Comma-separated. Supports wildcards.
Type: text
Required: ✅
Options
--strict
Fail if any templates aren't found. Should not be used in conjunction with wildcards.
Type: boolean
(flag)
Default: False
--clear
/--no-clear
Unlink and clear templates.
Type: boolean
(flag)
Default: True
--dryrun
Preview changes.
Type: boolean
(flag)
Default: False