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

20 Pie chart

説明

これらのパラメーターと、各ダッシュボードウィジェットフィールドオブジェクトの有効なプロパティ値を使用することで、dashboard.createメソッドおよびdashboard.updateメソッドで円グラフウィジェットを設定できます。

ウィジェットのfieldsプロパティは、ダッシュボードの作成または更新時に検証されません。 これにより、ユーザーは組み込みウィジェットを変更したり、カスタムウィジェットを作成したりできますが、ウィジェットを誤って作成または更新してしまうリスクも生じます。 円グラフウィジェットを正常に作成または更新するには、以下の表に記載されているパラメーターの動作を参照してください。

パラメーター

円グラフウィジェットでは、以下のパラメーターがサポートされています。

パラメーター type name value
リフレッシュ間隔 0 rf_rate 0 - 更新なし
10 - 10秒
30 - 30秒
60 - (デフォルト) 1分
120 - 2分
600 - 10分
900 - 15分

Data set

The following parameters are supported for configuring a Data set.

The first number in the property name (e.g. ds.0.hosts.0, ds.0.items.0) represents the particular data set, while the second number, if present, represents the configured host or item.

Parameter type name value
Data set type 0 ds.0.dataset_type 0 - Item list;
1 - (default) Item pattern.
Parameters if Data set type is set to "Item list"
Items 4 ds.0.itemids.0 Item ID.
When configuring the widget on a template dashboard, only items configured on the template should be set.

Note: To configure multiple items, create a dashboard widget field object for each item.

Parameter behavior:
- required
Color 1 ds.0.color.0 Hexadecimal color code (e.g. FF0000).
Item type 0 ds.0.type.0 0 - (default) Normal;
1 - Total.

Parameter Item type "Total" can be set only for one item in the whole chart.
Parameters if Data set type is set to "Item pattern"
Host pattern 1 ds.0.hosts.0 Host name or pattern (e.g., "Zabbix*").

Parameter Host pattern not available when configuring the widget on a template dashboard.

Parameter behavior:
- required
Item pattern 1 ds.0.items.0 Item name or pattern (e.g., "*: Number of processed *values per second").
When configuring the widget on a template dashboard, only the pattern for items configured on the template should be set.

Parameter behavior:
- required
Color 1 ds.0.color Hexadecimal color code (e.g. FF0000).
Aggregation function 0 ds.0.aggregate_function 1 - min;
2 - max;
3 - avg;
4 - count;
5 - sum;
6 - first;
7 - (default) last.
Data set aggregation 0 ds.0.dataset_aggregation 0 - (default) none;
1 - min;
2 - max;
3 - avg;
4 - count;
5 - sum.

Parameter Data set aggregation not available if Item type in "Item list" data set is set to "Total".
Data set label 1 ds.0.data_set_label Any string value.

Default: "" (empty).

Displaying options

The following parameters are supported for configuring Displaying options.

Parameter type name value
History data selection 0 source 0 - (default) Auto;
1 - History;
2 - Trends.
Draw 0 draw_type 0 - (default) Pie;
1 - Doughnut.
Space between sectors 0 space Valid values range from 0-10.

Default: 1.
Merge sectors smaller than N% (checkbox) 0 merge 0 - (default) Disabled;
1 - Enabled.
Merge sectors smaller than N% (value) 0 merge_percent Valid values range from 1-10.

Default: 1.

Parameter Merge sectors smaller than N% (value) not available if Merge sectors smaller than N% (checkbox) is set to "Disabled".
Merge sectors smaller than N% (color) 1 merge_color Hexadecimal color code (e.g. FF0000).
Parameters if Draw is set to "Doughnut"
Width 0 width 20 - 20% of the radius;
30 - 30% of the radius;
40 - 40% of the radius;
50 - (default) 50% of the radius.
Show total value 0 total_show 0 - (default) Disabled;
1 - Enabled.
Parameters if Show total value is set to "Enabled"
Size 0 value_size_type 0 - (default) Auto;
1 - Custom.
Size (value for custom size) 0 value_size Valid values range from 1-100.

Default: 20.
Decimal places 0 decimal_places Valid values range from 0-6.

Default: 2.
Units (checkbox) 0 units_show 0 - (default) Disabled;
1 - Enabled.
Units (value) 1 units Any string value.

Parameter Units (value) not available if Units (checkbox) is set to "Disabled".
Bold 0 value_bold 0 - (default) Disabled;
1 - Enabled.
Color 1 value_color Hexadecimal color code (e.g. FF0000).

Time period

The following parameters are supported for configuring Time period.

Parameter type name value
Set custom time period 0 graph_time 0 - (default) Disabled;
1 - Enabled.
From 1 time_from Valid time string in format YYYY-MM-DD hh:mm:ss.
Relative time period values (now, now/d, now/w-1w, etc.) are also supported.

Default: now-1h.
To 1 time_to Valid time string value in format YYYY-MM-DD hh:mm:ss.
Relative time period values (now, now/d, now/w-1w, etc.) are also supported.

Default: now.

Legend

The following parameters are supported for configuring Legend.

Parameter type name value
Show legend 0 legend 0 - Disabled;
1 - (default) Enabled.
Show aggregation function 0 legend_aggregation 0 - (default) Disabled;
1 - Enabled.
Number of rows 0 legend_lines Valid values range from 1-10.

Default: 1.
Number of columns 0 legend_columns Valid values range from 1-4.

Default: 4.

次の例は、円グラフウィジェットのダッシュボードウィジェットフィールドオブジェクトの設定を説明することだけを目的としています。 ダッシュボードの設定の詳細については、dashboard.createを参照してください。

円グラフウィジェットの設定

円グラフウィジェットは、以下の手順で設定します:

  • 1つのホストに、合計9つのアイテムのデータセットを2つ作成します。
  • 最初のデータセットはタイプが"アイテムリスト"で、3つのアイテムで構成されています。これらのアイテムはすべて"通常"タイプで、それぞれ異なる色で表示されます。
  • 2つめのデータセットはタイプが"アイテムパターン"で、6つのアイテムで構成されています。これらのアイテムは集計が設定され、カスタム色で表示されます。
  • 2つめのデータセットには、カスタムデータセットラベルも設定します。
  • 円グラフのデータは、幅がカスタムで、中央に単位が付いた合計値を持つドーナツグラフとして表示されます。
  • 円グラフのデータは、過去3時間のカスタム期間について表示および集計されます。
  • 円グラフの凡例には、設定されたアイテムが4行で表示されます。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "dashboard.create",
           "params": {
               "name": "My dashboard",
               "display_period": 30,
               "auto_start": 1,
               "pages": [
                   {
                       "widgets": [
                           {
                               "type": "piechart",
                               "name": "Pie chart",
                               "x": 0,
                               "y": 0,
                               "width": 24,
                               "height": 5,
                               "view_mode": 0,
                               "fields": [
                                   {
                                       "type": 0,
                                       "name": "ds.0.dataset_type",
                                       "value": 0
                                   },
                                   {
                                       "type": 4,
                                       "name": "ds.0.itemids.1",
                                       "value": 23264
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.0.color.1",
                                       "value": "FF0000"
                                   },
                                   {
                                       "type": 0,
                                       "name": "ds.0.type.1",
                                       "value": 0
                                   },
                                   {
                                       "type": 4,
                                       "name": "ds.0.itemids.2",
                                       "value": 23269
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.0.color.2",
                                       "value": "BF00FF"
                                   },
                                   {
                                     "type": 0,
                                     "name": "ds.0.type.2",
                                     "value": 0
                                   },
                                   {
                                       "type": 4,
                                       "name": "ds.0.itemids.3",
                                       "value": 23257
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.0.color.3",
                                       "value": "0040FF"
                                   },
                                   {
                                     "type": 0,
                                     "name": "ds.0.type.3",
                                     "value": 0
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.hosts.0",
                                       "value": "Zabbix server"
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.items.0",
                                       "value": "*: Number of processed *values per second"
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.color",
                                       "value": "000000"
                                   },
                                   {
                                       "type": 0,
                                       "name": "ds.1.aggregate_function",
                                       "value": 3
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.data_set_label",
                                       "value": "Number of processed values per second"
                                   },
                                   {
                                       "type": 0,
                                       "name": "draw_type",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "width",
                                       "value": 30
                                   },
                                   {
                                       "type": 0,
                                       "name": "total_show",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "units_show",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "graph_time",
                                       "value": 1
                                   },
                                   {
                                       "type": 1,
                                       "name": "time_period.from",
                                       "value": "now-3h"
                                   },
                                   {
                                       "type": 0,
                                       "name": "legend_lines",
                                       "value": 4
                                   }
                               ]
                           }
                       ]
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": 7,
                       "permission": 2
                   }
               ],
               "users": [
                   {
                       "userid": 1,
                       "permission": 3
                   }
               ]
           },
           "id": 1
       }

レスポンス:

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

参照