On this page
itemprototype.create
Description
object itemprototype.create(object/array itemPrototypes)
This method allows to create new item prototypes.
Parameters
(object/array) Item prototype to create.
Additionally to the standard item prototype properties, the method accepts the following parameters.
| Parameter | Type | Description |
|---|---|---|
| ruleid (required) |
string | ID of the LLD rule that the item belongs to. |
| applications | array | IDs of applications to be assigned to the discovered items. |
| applicationPrototypes | array | Names of application prototypes to be assigned to the item prototype. |
Return values
(object) Returns an object containing the IDs of the created item
prototypes under the itemids property. The order of the returned IDs
matches the order of the passed item prototypes.
Examples
Creating an item prototype
Create an item prototype to monitor free disc space on a discovered file system. Discovered items should be numeric Zabbix agent items updated every 30 seconds.
Request:
{
"jsonrpc": "2.0",
"method": "itemprototype.create",
"params": {
"name": "Free disk space on $1",
"key_": "vfs.fs.size[{#FSNAME},free]",
"hostid": "10197",
"ruleid": "27665",
"type": 0,
"value_type": 3,
"interfaceid": "112",
"delay": 30
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"itemids": [
"27666"
]
},
"id": 1
}
Source
CItemPrototype::create() in frontends/php/include/classes/api/services/CItemPrototype.php.