> Script object

The following objects are directly related to the script API.

Script

The script object has the following properties.

Property Type Description
scriptid string ID of the script.

Property behavior:
- read-only
- required for update operations
name string Name of the script.

Property behavior:
- required for create operations
type integer Script type.

Possible values if scope is set to "action operation":
0 - Script;
1 - IPMI;
2 - SSH;
3 - TELNET;
5 - Webhook.

Possible values if scope is set to "manual host action" or "manual event action":
6 - URL.

Property behavior:
- required for create operations
command string Command to run.

Property behavior:
- required if type is set to "Script", "IPMI", "SSH", "TELNET", or "Webhook"
scope integer Script scope.

Possible values:
1 - action operation;
2 - manual host action;
4 - manual event action.

Property behavior:
- required for create operations
execute_on integer Where to run the script.

Possible values:
0 - run on Zabbix agent;
1 - run on Zabbix server;
2 - (default) run on Zabbix server (proxy).

Property behavior:
- supported if type is set to "Script"
menu_path string Folders separated by slash that form a menu like navigation in frontend when clicked on host or event.

Property behavior:
- supported if scope is set to "manual host action" or "manual event action"
authtype integer Authentication method used for SSH script type.

Possible values:
0 - password;
1 - public key.

Property behavior:
- supported if type is set to "SSH"
username string User name used for authentication.

Property behavior:
- required if type is set to "SSH" or "TELNET"
password string Password used for SSH scripts with password authentication and TELNET scripts.

Property behavior:
- supported if type is set to "SSH" and authtype is set to "password", or type is set to "TELNET"
publickey string Name of the public key file used for SSH scripts with public key authentication.

Property behavior:
- required if type is set to "SSH" and authtype is set to "public key"
privatekey string Name of the private key file used for SSH scripts with public key authentication.

Property behavior:
- required if type is set to "SSH" and authtype is set to "public key"
port string Port number used for SSH and TELNET scripts.

Property behavior:
- supported if type is set to "SSH" or "TELNET"
groupid string ID of the host group that the script can be run on.

If set to "0", the script will be available on all host groups.

Default: 0.
usrgrpid string ID of the user group that will be allowed to run the script.

If set to "0", the script will be available for all user groups.

Default: 0.

Property behavior:
- supported if scope is set to "manual host action" or "manual event action"
host_access integer Host permissions needed to run the script.

Possible values:
2 - (default) read;
3 - write.

Property behavior:
- supported if scope is set to "manual host action" or "manual event action"
confirmation string Confirmation pop up text.
The pop up will appear when trying to run the script from the Zabbix frontend.

Property behavior:
- supported if scope is set to "manual host action" or "manual event action"
timeout string Webhook script execution timeout in seconds. Time suffixes are supported (e.g., 30s, 1m).

Possible values: 1-60s.

Default: 30s.

Property behavior:
- required if type is set to "Webhook"
parameters array Array of webhook input parameters.

Property behavior:
- supported if type is set to "Webhook"
description string Description of the script.
url string User defined URL.

Property behavior:
- required if type is set to "URL"
new_window integer Open URL in a new window.

Possible values:
0 - No;
1 - (default) Yes.

Property behavior:
- supported if type is set to "URL"

Webhook parameters

Parameters passed to webhook script when it is called have the following properties.

Property Type Description
name string Parameter name.

Property behavior:
- required
value string Parameter value. Supports macros.

Debug

Debug information of executed webhook script. The debug object has the following properties.

Property Type Description
logs array Array of log entries.
ms string Script execution duration in milliseconds.

Log entry

The log entry object has the following properties.

Property Type Description
level integer Log level.
ms string The time elapsed in milliseconds since the script was run before log entry was added.
message string Log message.