9 Graph (classic)

説明

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

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

パラメータ

以下のパラメータは、Graph (classic) ウィジェットでサポートされています。

Parameter type name value
Refresh interval 0 rf_rate 0 - 更新しない;
10 - 10秒;
30 - 30秒;
60 - (default) 1分;
120 - 2分;
600 - 10分;
900 - 15分。
Source 0 source_type 0 - (default) グラフ;
1 - シンプルグラフ。
Graph 6 graphid.0 Graph ID。

Parameter behavior:
- required if Source is set to "Graph"
Graph (Widget) 1 graphid._reference Graph ID の代わりに:
ABCDE._graphid - 互換性のあるウィジェットReference パラメータを "ABCDE" に設定したもの)をグラフのデータソースとして設定します。

Parameter behavior:
- required if Source is set to "Simple graph" and Graph is not set
Item 4 itemid.0 Item ID。

Parameter behavior:
- required if Source is set to "Simple graph" and Item (Widget) is not set
Item (Widget) 1 itemid._reference Item ID の代わりに:
ABCDE._itemid - 互換性のあるウィジェットReference パラメータを "ABCDE" に設定したもの)をアイテムのデータソースとして設定します。

Parameter behavior:
- required if Source is set to "Simple graph" and Item is not set
Time period 1 time_period._reference DASHBOARD._timeperiod - Time period セレクターをデータソースとして設定します。
ABCDE._timeperiod - 互換性のあるウィジェットReference パラメータを "ABCDE" に設定したもの)をデータソースとして設定します。

Default: DASHBOARD._timeperiod

また、時間範囲は FromTo パラメータのみで設定することもできます。
From 1 time_period.from 絶対時間構文(YYYY-MM-DD hh:mm:ss)または 相対 時間構文(nownow/dnow/w-1w など)で指定された有効な時間文字列。

Parameter behavior:
- supported if Time period is not set
- required if time_period.to is set
To 1 time_period.to 絶対時間構文(YYYY-MM-DD hh:mm:ss)または 相対 時間構文(nownow/dnow/w-1w など)で指定された有効な時間文字列。

Parameter behavior:
- supported if Time period is not set
- required if time_period.from is set
Show legend 0 show_legend 0 - 無効;
1 - (default) 有効。
Override host 1 override_hostid._reference ABCDE._hostid - 互換性のあるウィジェットReference パラメータを "ABCDE" に設定したもの)をホストのデータソースとして設定します。
DASHBOARD._hostid - ダッシュボードの Host セレクター をホストのデータソースとして設定します。

このパラメータは、テンプレートダッシュボード 上でウィジェットを設定する場合はサポートされません。
Reference 1 reference 5文字からなる任意の文字列値(例: ABCDE または JBPNL)。この値は、ウィジェットが属するダッシュボード内で一意である必要があります。

Parameter behavior:
- required

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

グラフ(クラシック)ウィジェットの設定

アイテム"42269"のシンプルなグラフを表示するグラフ(クラシック)ウィジェットを設定します。

リクエスト:

{
    "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": 36,
                        "height": 5,
                        "view_mode": 0,
                        "fields": [
                            {
                                "type": 0,
                                "name": "source_type",
                                "value": 1
                            },
                            {
                                "type": 4,
                                "name": "itemid.0",
                                "value": 42269
                            },
                            {
                                "type": 1,
                                "name": "reference",
                                "value": "RSTUV"
                            }
                        ]
                    }
                ]
            }
        ],
        "userGroups": [
            {
                "usrgrpid": 7,
                "permission": 2
            }
        ],
        "users": [
            {
                "userid": 1,
                "permission": 3
            }
        ]
    },
    "id": 1
}

レスポンス:

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

参照