11 Graph prototype

Description

These parameters and the possible property values for the respective dashboard widget field objects allow to configure the Graph prototype widget in dashboard.create and dashboard.update methods.

Widget fields properties are not validated during the creation or update of a dashboard. This allows users to modify built-in widgets and create custom widgets, but also introduces the risk of creating or updating widgets incorrectly. To ensure the successful creation or update of the Graph prototype widget, please refer to the parameter behavior outlined in the tables below.

Parameters

The following parameters are supported for the Graph prototype widget.

Parameter type name value
Refresh interval 0 rf_rate 0 - No refresh;
10 - 10 seconds;
30 - 30 seconds;
60 - (default) 1 minute;
120 - 2 minutes;
600 - 10 minutes;
900 - 15 minutes.
Source 0 source_type 2 - (default) Graph prototype;
3 - Simple graph prototype.
Graph prototype 7 graphid.0 Graph prototype ID.

Parameter behavior:
- required if Source is set to "Graph prototype"
Item prototype 5 itemid.0 Item prototype ID.

Parameter behavior:
- required if Source is set to "Simple graph prototype"
Time period 1 time_period._reference DASHBOARD._timeperiod - set the Time period selector as the data source;
ABCDE._timeperiod - set a compatible widget (with its Reference parameter set to "ABCDE") as the data source.

Default: DASHBOARD._timeperiod

Alternatively, you can set the time period only in the From and To parameters.
From 1 time_period.from Valid time string in absolute (YYYY-MM-DD hh:mm:ss) or relative time syntax (now, now/d, now/w-1w, etc.).

Parameter behavior:
- supported if Time period is not set
To 1 time_period.to Valid time string in absolute (YYYY-MM-DD hh:mm:ss) or relative time syntax (now, now/d, now/w-1w, etc.).

Parameter behavior:
- supported if Time period is not set
Show legend 0 show_legend 0 - Disabled;
1 - (default) Enabled.
Override host 1 override_hostid._reference ABCDE._hostid - set a compatible widget (with its Reference parameter set to "ABCDE") as the data source for hosts;
DASHBOARD._hostid - set the dashboard Host selector as the data source for hosts.

This parameter is not supported if configuring the widget on a template dashboard.
Columns 0 columns Possible values range from 1-24.

Default: 2.
Rows 0 rows Possible values range from 1-16.

Default: 1.
Reference 1 reference Any string value consisting of 5 characters (e.g., ABCDE or JBPNL). This value must be unique within the dashboard to which the widget belongs.

Parameter behavior:
- required

Examples

The following examples aim to only describe the configuration of the dashboard widget field objects for the Graph prototype widget. For more information on configuring a dashboard, see dashboard.create.

Configuring a Graph prototype widget

Configure a Graph prototype widget that displays a grid of 3 graphs (3 columns, 1 row) created from an item prototype (ID: "42316") by low-level discovery.

Request:

{
           "jsonrpc": "2.0",
           "method": "dashboard.create",
           "params": {
               "name": "My dashboard",
               "display_period": 30,
               "auto_start": 1,
               "pages": [
                   {
                       "widgets": [
                           {
                               "type": "graphprototype",
                               "name": "Graph prototype",
                               "x": 0,
                               "y": 0,
                               "width": 48,
                               "height": 5,
                               "view_mode": 0,
                               "fields": [
                                   {
                                       "type": 0,
                                       "name": "source_type",
                                       "value": 3
                                   },
                                   {
                                       "type": 5,
                                       "name": "itemid.0",
                                       "value": 42316
                                   },
                                   {
                                       "type": 0,
                                       "name": "columns",
                                       "value": 3
                                   },
                                   {
                                       "type": 1,
                                       "name": "reference",
                                       "value": "OPQWX"
                                   }
                               ]
                           }
                       ]
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": 7,
                       "permission": 2
                   }
               ],
               "users": [
                   {
                       "userid": 1,
                       "permission": 3
                   }
               ]
           },
           "id": 1
       }

Response:

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

See also