This method allows to create a new task (such as collect diagnostic data or check items or low-level discovery rules without config reload).
Starting from Zabbix version 5.0.5, task.create
accepts array of task objects object/array **tasks**
, allowing to create multiple tasks in single request.
Parameters
A task to create.
The method accepts the following parameters. Please use this format for Zabbix versions before 5.0.5 only.
Please be aware that starting from Zabbix version 5.0.5, request format has changed:
Parameter | Type | Description |
---|---|---|
type (required) | integer | Task type. Possible values: 1 - Diagnostic information; 6 - Check now. |
request (required) | object | Task request object according to the task type. Correct format of request object is described in section. |
proxy_hostid | integer | Proxy about which Diagnostic information task will collect data. Ignored for Check now tasks. |
Note that ‘Check now’ tasks can be created for the following types of items/discovery rules:
SNMPv1/v2/v3 agent
Simple check
Aggregate check
External check
Database monitor
HTTP agent
SSH agent
TELNET agent
Calculated check
JMX agent
Examples
Creating a task
Create a task check now
for two items. One is an item, the other is a low-level discovery rule.
Request for Zabbix versions before 5.0.5:
Same request for Zabbix versions starting from 5.0.5:
Response is similar for both example requests:
Create a task diagnostic information
task. Request:
Response:
Source
CTask::create() in ui/include/classes/api/services/CTask.php.