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.

history.push

Description

object history.push(object/array itemHistoryData)

This method allows sending item history data to Zabbix server.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) Item history data to send.

The method supports the following parameters.

Parameter Type Description
itemid ID ID of the related item.

Parameter behavior:
- required if host and key are not set
host string Technical name of the host.

Parameter behavior:
- required if itemid is not set
key string Item key.

Parameter behavior:
- required if itemid is not set
value mixed Item value.

Parameter behavior:
- required
clock timestamp Time when the value was received.
ns integer Nanoseconds when the value was received.

Return values

(object) Returns the result of the data sending operation.

Examples

Send item history data

Send item history data to Zabbix server for items "10600", "10601", and "999999".

Request:

{
           "jsonrpc": "2.0",
           "method": "history.push",
           "params": [
               {
                   "itemid": 10600,
                   "value": 0.5,
                   "clock": 1690891294,
                   "ns": 45440940
               },
               {
                   "itemid": 10600,
                   "value": 0.6,
                   "clock": 1690891295,
                   "ns": 312431
               },
               {
                   "itemid": 10601,
                   "value": "[Tue Aug 01 15:01:35 2023] [error] [client 1.2.3.4] File does not exist: /var/www/html/robots.txt"
               },
               {
                   "itemid": 999999,
                   "value": 123
               }
           ],
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "response": "success",
               "data": [
                   {
                       "itemid": "10600"
                   },
                   {
                       "itemid": "10600"
                   },
                   {
                       "itemid": "10601",
                       "error": "Item is disabled."
                   },
                   {
                       "error": "No permissions to referred object or it does not exist."
                   }
               ]
           },
           "id": 1
       }

See also

Source

CHistory::push() in ui/include/classes/api/services/CHistory.php.