Sidebar

Zabbix Summit 2022
Register for Zabbix Summit 2022

创建

Description 描述

object screen.create(object/array screens)

This method allows to create new screens. 此方法允许创建新的聚合图形

Parameters 参数

(object/array) Screens to create. (object/array)创建聚合图形

Additionally to the standard screen properties, the method accepts the following parameters. 此外 standard screen properties,此方法接受以下参数:

Parameter Type Description
screenitems array Screen items to be created for the screen. 为聚合图形创建聚合图形项
users array Screen user shares to be created on the screen. 聚合图形用户共享在聚合图形上创建
userGroups array Screen user group shares to be created on the screen. 聚合图形用户组共享在聚合图形上创建

Return values 返回值

(object) Returns an object containing the IDs of the created screens under the screenids property. The order of the returned IDs matches the order of the passed screens. (object) 返回一个对象,该对象包含在screenids属性下创建的聚合图形的id。返回的id的顺序与传递的聚合图形的顺序相匹配。

Examples 示例如下

Creating a screen 创建一个聚合图形

Create a screen named "Graphs" with 2 rows and 3 columns and add a graph to the upper-left cell. 创建一个2行3列名字叫"Graphs"的聚合图形,并且在表格的左上角添加一个图形。

Request:

{
           "jsonrpc": "2.0",
           "method": "screen.create",
           "params": {
               "name": "Graphs",
               "hsize": 3,
               "vsize": 2,
               "screenitems": [
                   {
                       "resourcetype": 0,
                       "resourceid": "612",
                       "rowspan": 1,
                       "colspan": 1,
                       "x": 0,
                       "y": 0
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "screenids": [
                   "26"
               ]
           },
           "id": 1
       }

Screen sharing

Create a screen with two types of sharing (user and user group). 创建一个两种共享类型的聚合图形(用户和用户组)

Request:

{
           "jsonrpc": "2.0",
           "method": "screen.create",
           "params": {
               "name": "Screen sharing",
               "hsize": 3,
               "vsize": 2,
               "users": [
                   {
                       "userid": "4",
                       "permission": "3"
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": "7",
                       "permission": "2"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "screenids": [
                   "83"
               ]
           },
           "id": 1
       }

See also

Source

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