You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

Task object

The following objects are directly related to the task API.

The task object has the following properties:

Property Type Description
taskid ID ID of the task.

Property behavior:
- read-only
type integer Type of the task.

Possible values:
1 - Diagnostic information;
2 - Refresh proxy configuration;
6 - Execute now.

Property behavior:
- required
status integer Status of the task.

Possible values:
1 - new task;
2 - task in progress;
3 - task is completed;
4 - task is expired.

Property behavior:
- read-only
clock timestamp Time when the task was created.

Property behavior:
- read-only
ttl integer The time in seconds after which task expires.

Property behavior:
- read-only
proxyid ID ID of the proxy about which diagnostic information statistic is collected.

Property behavior:
- supported if type is set to "Diagnostic information" or "Refresh proxy configuration"
request object Task request object according to the task type:
Object of 'Execute now' task is described in detail below;
Object of 'Refresh proxy configuration' task is described in detail below;
Object of 'Diagnostic information' task is described in detail below.

Property behavior:
- required
result object Result object of the diagnostic information task.
May contain NULL if result is not yet ready.
Result object is described in detail below.

Property behavior:
- read-only

'Execute now' request object

The 'Execute now' task request object has the following properties.

Property Type Description
itemid ID ID of item and low-level discovery rules.

'Refresh proxy configuration' request object

The 'Refresh proxy configuration' task request object has the following properties.

Property Type Description
proxyids array Proxy IDs.

'Diagnostic information' request object

The diagnostic information task request object has the following properties. Statistic request object for all types of properties is described in detail below.

Property Type Description
historycache object History cache statistic request. Available on server and proxy.
valuecache object Items cache statistic request. Available on server.
preprocessing object Preprocessing manager statistic request. Available on server and proxy.
alerting object Alert manager statistic request. Available on server.
lld object LLD manager statistic request. Available on server.

Statistic request object

Statistic request object is used to define what type of information should be collected about server/proxy internal processes. It has the following properties.

Property Type Description
stats query Statistic object properties to be returned.
The list of available fields for each type of diagnostic information statistic are described in detail below.

Default: extend will return all available statistic fields.
top object Object to sort and limit returned statistic values.
The list of available fields for each type of diagnostic information statistic are described in detail below.

Example: { “source.alerts”: 10 }
List of statistic fields available for each type of diagnostic information request

Following statistic fields can be requested for each type of diagnostic information request property.

Diagnostic type Available fields Description
historycache items Number of cached items.
values Number of cached values.
memory Shared memory statistics (free space, number of used chunks, number of free chunks, max size of free chunk).
memory.data History data cache shared memory statistics.
memory.index History index cache shared memory statistics.
valuecache items Number of cached items.
values Number of cached values.
memory Shared memory statistics (free space, number of used chunks, number of free chunks, max size of free chunk).
mode Value cache mode.
preprocessing values Number of queued values.
preproc.values Number of queued values with preprocessing steps.
alerting alerts Number of queued alerts.
lld rules Number of queued rules.
values Number of queued values.
List of sorting fields available for each type of diagnostic information request

Following statistic fields can be used to sort and limit requested information.

Diagnostic type Available fields Type
historycache values integer
valuecache values integer
request.values integer
preprocessing values integer
alerting media.alerts integer
source.alerts integer
lld values integer

Statistic result object

Statistic result object is retrieved in result field of task object.

Property Type Description
status integer Status of the task result.

Possible values:
-1 - error occurred during performing task;
0 - task result is created.

Property behavior:
- read-only
data string/object Results according the statistic request object of particular diagnostic information task.
Contains error message string if error occurred during performing task.