> Script object

The following objects are directly related to the script API.

Script

The script object has the following properties.

PropertyTypeDescription
scriptidstring(readonly) ID of the script.
name
(required)
stringName of the script.
type
(required)
integerScript type.

Possible values:
0 - Script;
1 - IPMI;
2 - SSH;
3 - Telnet;
5 - (default) Webhook.
command
(required)
stringCommand to run.
scopeintegerScript scope.

Possible values:
1 - default action operation;
2 - manual host action;
4 - manual event action.
execute_onintegerWhere to run the script.
Used if type is 0 (script).

Possible values:
0 - run on Zabbix agent;
1 - run on Zabbix server;
2 - (default) run on Zabbix server (proxy).
menu_pathstringFolders separated by slash that form a menu like navigation in frontend when clicked on host or event.
Used if scope is 2 or 4.
authtypeintegerAuthentication method used for SSH script type.
Used if type is 2.

Possible values:
0 - password;
1 - public key.
usernamestringUser name used for authentication.
Required if type is 2 or 3.
passwordstringPassword used for SSH scripts with password authentication and Telnet scripts.
Used if type is 2 and authtype is 0 or type is 3.
publickeystringName of the public key file used for SSH scripts with public key authentication.
Required if type is 2 and authtype is 1.
privatekeystringName of the private key file used for SSH scripts with public key authentication.
Required if type is 2 and authtype is 1.
portstringPort number used for SSH and Telnet scripts.
Used if type is 2 or 3.
groupidstringID 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.
usrgrpidstringID 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.
Used if scope is 2 or 4.

Default: 0.
host_accessintegerHost permissions needed to run the script.
Used if scope is 2 or 4.

Possible values:
2 - (default) read;
3 - write.
confirmationstringConfirmation pop up text. The pop up will appear when trying to run the script from the Zabbix frontend.
Used if scope is 2 or 4.
timeoutstringWebhook script execution timeout in seconds. Time suffixes are supported, e.g. 30s, 1m.
Required if type is 5.

Possible values:
1-60s

Default value:
30s
parametersarrayArray of webhook input parameters.
Used if type is 5.
descriptionstringDescription of the script.

Webhook parameters

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

PropertyTypeDescription
name
(required)
stringParameter name.
valuestringParameter value. Supports macros.

Debug

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

PropertyTypeDescription
logsarrayArray of log entries.
msstringScript execution duration in milliseconds.

Log entry

The log entry object has the following properties.

PropertyTypeDescription
levelintegerLog level.
msstringThe time elapsed in milliseconds since the script was run before log entry was added.
messagestringLog message.