Skip to content

Macro

define_global_macro

define_global_macro <NAME> <VALUE>

Create a global macro.

Arguments

NAME
Name of the macro
Type: text
Required:

VALUE
Value of the macro
Type: text
Required:


define_host_usermacro

define_host_usermacro <HOSTNAME> <MACRO_NAME> <MACRO_VALUE>

Create or update a host usermacro.

Examples

Create a macro named {$SNMP_COMMUNITY} for a host

define_host_usermacro foo.example.com '{$SNMP_COMMUNITY}' public

Create a macro named {$SITE_URL} for a host (automatic name conversion)

define_host_usermacro foo.example.com site_url https://example.com

Arguments

HOSTNAME
Host to define macro for.
Type: text
Required:

MACRO_NAME
Name of macro. Names will be converted to the Zabbix format, i.e. site_url becomes {$SITE_URL}.
Type: text
Required:

MACRO_VALUE
Default value of macro.
Type: text
Required:


show_global_macros

show_global_macros

Show all global macros.


show_host_usermacros

show_host_usermacros <HOSTNAME_OR_ID>

Show all macros defined for a host.

Arguments

HOSTNAME_OR_ID
Hostname or ID to show macros for
Type: text
Required:


show_usermacro_host_list

show_usermacro_host_list <USERMACRO> [OPTIONS]

Find all hosts with a user macro of the given name.

Renders a list of the complete macro object and its hosts in JSON mode.

Arguments

USERMACRO
Name of macro to find hosts with. Macro names are automatically formatted, e.g. site_url becomes {$SITE_URL}.
Type: text
Required:

Options

--limit, -n <LIMIT>
Limit the number of results. 0 to show all.
Type: integer
Default: 0


show_usermacro_template_list

show_usermacro_template_list <MACRO_NAME> [OPTIONS]

Find all templates with a user macro of the given name.

Examples

Show all templates with a user macro named {$SNMP_COMMUNITY}

show_usermacro_template_list SNMP_COMMUNITY

Arguments

MACRO_NAME
Name of the macro to find templates with. Automatically formatted.
Type: text
Required:

Options

--limit, -n <LIMIT>
Limit the number of results. 0 to show all.
Type: integer
Default: 0