> Script object

The following objects are directly related to the script API.

Script

The script object has the following properties.

PropertyTypeDescription
scriptidstringID of the script.

Property behavior:
- read-only
- required for update operations
namestringName of the script.

Property behavior:
- required for create operations
typeintegerScript 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
commandstringCommand to run.

Property behavior:
- required if type is set to “Script”, “IPMI”, “SSH”, “TELNET”, or “Webhook”
scopeintegerScript scope.

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

Property behavior:
- required for create operations
execute_onintegerWhere 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_pathstringFolders 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”
authtypeintegerAuthentication method used for SSH script type.

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

Property behavior:
- supported if type is set to “SSH”
usernamestringUser name used for authentication.

Property behavior:
- required if type is set to “SSH” or “TELNET”
passwordstringPassword 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”
publickeystringName 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”
privatekeystringName 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”
portstringPort number used for SSH and TELNET scripts.

Property behavior:
- supported if type is set to “SSH” or “TELNET”
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.

Default: 0.

Property behavior:
- supported if scope is set to “manual host action” or “manual event action”
host_accessintegerHost 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”
confirmationstringConfirmation 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”
timeoutstringWebhook 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”
parametersarrayArray of webhook input parameters.

Property behavior:
- supported if type is set to “Webhook”
descriptionstringDescription of the script.
urlstringUser defined URL.

Property behavior:
- required if type is set to “URL”
new_windowintegerOpen 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.

PropertyTypeDescription
namestringParameter name.

Property behavior:
- required
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.