This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.
Table of Contents

create()

This function allows you to create a script as defined by the script data array.

Parameters

Parameter Type Optional Description Details
script data array or object Array of Script objects or a single object scriptid shouldn't be specified

Returns

Parameter Description
result Operation successful. Result will contain array of created Script IDs. scriptid are assigned to each Script object
error In case of any errors

Example

Create new script for all hosts and host groups:

{
       "jsonrpc":"2.0",
       "method":"script.create",
       "params":{
           "name":"Ping",
           "command":"\/bin\/ping -c 3 {HOST.CONN}",
           "host_access":"2",
           "usrgrpid":"0",
           "groupid":"0"
       },
       "auth":"038e1d7b1735c6a5436ee9eae095879e",
       "id":2
       }

Script created successfully:

{
       "jsonrpc":"2.0",
       "result":{
          "scriptids": ["100100000214797"]
       },
       "id":2
       }

Script already exists:

{
       "jsonrpc":"2.0",
       "error":{
             "code":-32602,
             "message":"Invalid params.",
             "data":"[ CScript::create ] Cannot create Script"
       },
       "id":2
       }