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

dashboard.create

Description

object dashboard.create(object/array dashboards)

This method allows to create new dashboards.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) Dashboards to create.

Additionally to the standard dashboard properties, the method accepts the following parameters.

Parameter Type Description
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.

Valori restituiti

(object) Restituisce un oggetto contenente gli ID del dashboard creato sotto la proprietà dashboardids. L'ordine degli ID restituiti corrispondono all'ordine dei dashboard passati.

Esempi

Creating a dashboard

Create a dashboard named "My dashboard" with one Problems widget with tags and using two types of sharing (user group and user) on a single dashboard page.

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
       }

Guarda anche

Fonte

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