2022 Zabbix中国峰会
2022 Zabbix中国峰会


Description 说明

object itemprototype.create(object/array itemPrototypes)

This method allows to create new item prototypes.这种方法允许创建新的item prototypes。

Parameters 参数

(object/array) Item prototype to create.要创建的item prototypes

Additionally to the standard item prototype properties, the method accepts the following parameters.除标准项原型属性外,该方法还接受以下参数。

属性 类 说明
string ID of the LLD rule that the item belongs to.该项所属的LLD规则的ID。
applications array IDs of applications to be assigned to the discovered items. 要分配给发现项目的应用程序的ID。
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.返回一个包含“itemid”属性下创建的item prototypes的ID的对象。 返回的ID的顺序与传递的item prototypes的顺序相匹配。

Examples 示例

Creating an item prototype 创建一个item prototypes

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.


           "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": "30s"
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1


           "jsonrpc": "2.0",
           "result": {
               "itemids": [
           "id": 1

Source 来源

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