9 Graph (classic)

Description

These parameters and the possible property values for the respective dashboard widget field objects allow to configure the Graph (classic) 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 (classic) widget, please refer to the parameter behavior outlined in the tables below.

Parameters

The following parameters are supported for the Graph (classic) 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 0 - (default) Graph;
1 - Simple graph.
Graph 6 graphid Graph ID.

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

Parameter behavior:
- required if Source is set to "Simple graph"
Show legend 0 show_legend 0 - Disabled;
1 - (default) Enabled.
Enable host selection 0 dynamic 0 - (default) Disabled;
1 - Enabled.

Examples

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

Configuring a Graph (classic) widget

Configure a Graph (classic) widget that displays a simple graph for the item "42269".

Request:

{
           "jsonrpc": "2.0",
           "method": "dashboard.create",
           "params": {
               "name": "My dashboard",
               "display_period": 30,
               "auto_start": 1,
               "pages": [
                   {
                       "widgets": [
                           {
                               "type": "graph",
                               "name": "Graph (classic)",
                               "x": 0,
                               "y": 0,
                               "width": 12,
                               "height": 5,
                               "view_mode": 0,
                               "fields": [
                                   {
                                       "type": 0,
                                       "name": "source_type",
                                       "value": 1
                                   },
                                   {
                                       "type": 4,
                                       "name": "itemid",
                                       "value": 42269
                                   }
                               ]
                           }
                       ]
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": 7,
                       "permission": 2
                   }
               ],
               "users": [
                   {
                       "userid": 1,
                       "permission": 3
                   }
               ]
           },
           "id": 1
       }

Response:

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

See also