Sidebar

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

screen.create

说明

object screen.create(object/array screens)

该方法允许创建新screen。

参数

(object/array) Screens to create.

除了 标准screen属性之外, 该方法接受以下参数。

属性 类 说明
screenitems array 要为screen创建的Screen items
users array 在screen上创建screen用户共享。
userGroups array 在screen上创建screen用户组共享。

返回值

(object) 返回一个包含“screenid”属性下创建的screen ID的对象。 返回的ID的顺序与传递的screen的顺序相匹配。

示例

Creating a screen

Create a screen named "Graphs" with 2 rows and 3 columns and add a graph to the upper-left cell.

Request:

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

Response:

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

Screen共享

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
       }

参见

来源

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