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.

item.create

Description

object item.create(object/array items)

This method allows to create new items.

Web items cannot be created via the Zabbix API.

Parameters

(object/array) Items to create.

Additionally to the standard item properties, the method accepts the following parameters.

Parameter Type Description
applications array IDs of the applications to add the item to.
preprocessing array Item preprocessing options.

Return values

(object) Returns an object containing the IDs of the created items under the itemids property. The order of the returned IDs matches the order of the passed items.

Examples

Creating an item

Create a numeric Zabbix agent item to monitor free disk space on host with ID "30074" and add it to two applications.

Request:

{
           "jsonrpc": "2.0",
           "method": "item.create",
           "params": {
               "name": "Free disk space on $1",
               "key_": "vfs.fs.size[/home/joe/,free]",
               "hostid": "30074",
               "type": 0,
               "value_type": 3,
               "interfaceid": "30084",
               "applications": [
                   "609",
                   "610"
               ],
               "delay": "30s"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "24758"
               ]
           },
           "id": 1
       }

Creating a host inventory item

Create a Zabbix agent item to populate the host's "OS" inventory field.

Request:

{
           "jsonrpc": "2.0",
           "method": "item.create",
           "params": {
               "name": "uname",
               "key_": "system.uname",
               "hostid": "30021",
               "type": 0,
               "interfaceid": "30007",
               "value_type": 1,
               "delay": "10s",
               "inventory_link": 5
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "24759"
               ]
           },
           "id": 1
       }

Creating an item with preprocessing

Create an item using custom multiplier.

Request:

{
           "jsonrpc": "2.0",
           "method": "item.create",
           "params": {
               "name": "Device uptime",
               "key_": "sysUpTime",
               "hostid": "11312",
               "type": 4,
               "snmp_community": "{$SNMP_COMMUNITY}",
               "snmp_oid": "SNMPv2-MIB::sysUpTime.0",
               "value_type": 1,
               "delay": "60s",
               "units": "uptime",
               "interfaceid": "1156",
               "preprocessing": [
                   {
                       "type": "1",
                       "params": "0.01"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "44210"
               ]
           },
           "id": 1
       }

Creating dependent item

Create Dependent item for Master item with ID 24759. Only dependencies on same host are allowed, therefore Master and Dependent item should have same hostid.

Request:

{
           "jsonrpc": "2.0",
           "method": "item.create",
           "params": {
             "hostid": "30074",
             "name": "Dependent test item",
             "key_": "dependent.item",
             "type": "18",
             "master_itemid": "24759",
             "value_type": "2"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "44211"
               ]
           },
           "id": 1
       }

Source

CItem::create() in frontends/php/include/classes/api/services/CItem.php.