This is a translation of the original English documentation page. Help us make it better.

dashboard.create

説明

object dashboard.create(object/array dashboards)

この方法では、新しいダッシュボードを作成することができます。

このメソッドは、どのタイプのユーザーでも利用可能です。このメソッドを呼び出す許可は、ユーザーロール設定で
取り消すことができます。詳しくは User roles をご覧ください。

パラメータ

(object/array) 作成するダッシュボード

standard dashboard properties に加えて、このメソッドは次のパラメータを受け付けます。

パラメータ Type 説明
pages
(required)
array Dashboard pages to be created for the dashboard. Dashboard pages will be ordered in the same order as specified. At least one dashboard page object is required for pages property.
users array Dashboard user shares to be created on the dashboard.
userGroups array Dashboard user group shares to be created on the dashboard.

戻り値

(object) dashboardids プロパティの下に作成されたダッシュボードの ID を含むオブジェクトを返します。
返される ID の順序は、渡されたダッシュボードの順序と一致します。

ダッシュボードを作成する

1つのダッシュボードページに、タグ付きのProblemsウィジェットを1つ、2種類の共有(ユーザーグループとユーザー)を
使用して、"My dashboard" という名前のダッシュボードを作成します。

Request:

{
           "jsonrpc": "2.0",
           "method": "dashboard.create",
           "params": {
               "name": "My dashboard",
               "display_period": 30,
               "auto_start": 1,
               "pages": [
                   {
                       "widgets": [
                           {
                               "type": "problems",
                               "x": 0,
                               "y": 0,
                               "width": 12,
                               "height": 5,
                               "view_mode": 0,
                               "fields": [
                                   {
                                       "type": 1,
                                       "name": "tags.tag.0",
                                       "value": "service"
                                   },
                                   {
                                       "type": 0,
                                       "name": "tags.operator.0",
                                       "value": 1
                                   },
                                   {
                                       "type": 1,
                                       "name": "tags.value.0",
                                       "value": "zabbix_server"
                                   }
                               ]
                           }
                       ]
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": "7",
                       "permission": 2
                   }
               ],
               "users": [
                   {
                       "userid": "4",
                       "permission": 3
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "dashboardids": [
                   "2"
               ]
           },
           "id": 1
       }

参照

ソース

CDashboard::create() in ui/include/classes/api/services/CDashboard.php.