graph.get

説明

integer/array graph.get(object parameters)

このメソッドは、指定したパラメーターに応じたグラフを取得できます。

このメソッドは、すべてのタイプのユーザーが利用できます。メソッドを呼び出す権限は、ユーザーの役割の設定で取り消すことができます。詳細はユーザーの役割を参照してください。

パラメーター

(object) 望ましい出力を定義するパラメーター。

このメソッドは以下のパラメーターをサポートします。

パラメーター 説明
graphids ID/array 指定したIDのグラフのみを返します。
groupids ID/array 指定したホストグループまたはテンプレートグループに属するホストまたはテンプレートのグラフのみを返します。
templateids ID/array 指定したテンプレートに属するグラフのみを返します。
hostids ID/array 指定したホストに属するグラフのみを返します。
itemids ID/array 指定したアイテムを含むグラフのみを返します。
templated boolean trueに設定すると、テンプレートに属するグラフのみを返します。
inherited boolean trueに設定すると、テンプレートから継承されたグラフのみを返します。
expandName flag グラフ名のマクロを展開します。
selectDiscoveryData query グラフディスカバリーオブジェクトデータを持つdiscoveryDataプロパティを返します。グラフディスカバリーオブジェクトは、検出されたグラフを、そのグラフが検出されたグラフプロトタイプにリンクします。

以下のプロパティを持ちます:
parent_graphid - (ID) グラフが作成されたグラフプロトタイプのID;
status - (int) グラフディスカバリーステータス:
0 - (デフォルト) グラフが検出されている,
1 - グラフがもはや検出されていない;
ts_delete - (timestamp) もはや検出されていないグラフが削除される時刻。
selectDiscoveryRule query グラフを作成した低レベルディスカバリールールを持つdiscoveryRuleプロパティを返します。
selectHostGroups query グラフが属するホストグループを持つhostgroupsプロパティを返します。
selectTemplateGroups query グラフが属するテンプレートグループを持つtemplategroupsプロパティを返します。
selectTemplates query グラフが属するテンプレートを持つtemplatesプロパティを返します。
selectHosts query グラフが属するホストを持つhostsプロパティを返します。
selectItems query グラフで使用されているアイテムを持つitemsプロパティを返します。
selectGraphItems query グラフで使用されているアイテムを持つgitemsプロパティを返します。
filter object 指定したフィルターと完全一致する結果のみを返します。

オブジェクトを受け入れ、キーはプロパティ名、値は一致させる単一値または値の配列です。

textデータ型のプロパティはサポートされていません。

追加プロパティをサポートします:
host - グラフが属するホストの技術名;
hostid - グラフが属するホストのID。
sortfield string/array 指定したプロパティで結果をソートします。

利用可能な値: graphid, name, graphtype
countOutput boolean これらのパラメーターはリファレンス解説で説明されています。
editable boolean
excludeSearch boolean
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean
selectGraphDiscovery query グラフディスカバリーオブジェクトを持つgraphDiscoveryプロパティを返します。グラフディスカバリーオブジェクトは、グラフを作成元のグラフプロトタイプにリンクします。

このクエリは非推奨です。代わりにselectDiscoveryDataを使用してください。

戻り値

(integer/array) 次のいずれかを返します:

  • オブジェクトの配列
  • countOutputパラメーターが使用されている場合、取得したオブジェクトの数

ホストからグラフの取得

ホスト"10107"から全てのグラフを取得し、名前でソートします。

リクエスト:

{
    "jsonrpc": "2.0",
    "method": "graph.get",
    "params": {
        "output": "extend",
        "hostids": 10107,
        "sortfield": "name"
    },
    "id": 1
}

レスポンス:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "graphid": "612",
            "name": "CPU jumps",
            "width": "900",
            "height": "200",
            "yaxismin": "0",
            "yaxismax": "100",
            "templateid": "439",
            "show_work_period": "1",
            "show_triggers": "1",
            "graphtype": "0",
            "show_legend": "1",
            "show_3d": "0",
            "percent_left": "0",
            "percent_right": "0",
            "ymin_type": "0",
            "ymax_type": "0",
            "ymin_itemid": "0",
            "ymax_itemid": "0",
            "flags": "0"
        },
        {
            "graphid": "613",
            "name": "CPU load",
            "width": "900",
            "height": "200",
            "yaxismin": "0",
            "yaxismax": "100",
            "templateid": "433",
            "show_work_period": "1",
            "show_triggers": "1",
            "graphtype": "0",
            "show_legend": "1",
            "show_3d": "0",
            "percent_left": "0",
            "percent_right": "0",
            "ymin_type": "1",
            "ymax_type": "0",
            "ymin_itemid": "0",
            "ymax_itemid": "0",
            "flags": "0"
        },
        {
            "graphid": "614",
            "name": "CPU utilization",
            "width": "900",
            "height": "200",
            "yaxismin": "0",
            "yaxismax": "100",
            "templateid": "387",
            "show_work_period": "1",
            "show_triggers": "0",
            "graphtype": "1",
            "show_legend": "1",
            "show_3d": "0",
            "percent_left": "0",
            "percent_right": "0",
            "ymin_type": "1",
            "ymax_type": "1",
            "ymin_itemid": "0",
            "ymax_itemid": "0",
            "flags": "0"
        },
        {
            "graphid": "645",
            "name": "Disk space usage /",
            "width": "600",
            "height": "340",
            "yaxismin": "0",
            "yaxismax": "0",
            "templateid": "0",
            "show_work_period": "0",
            "show_triggers": "0",
            "graphtype": "2",
            "show_legend": "1",
            "show_3d": "1",
            "percent_left": "0",
            "percent_right": "0",
            "ymin_type": "0",
            "ymax_type": "0",
            "ymin_itemid": "0",
            "ymax_itemid": "0",
            "flags": "4"
        }
    ],
    "id": 1
}

参照

ソース

CGraph::get() in ui/include/classes/api/services/CGraph.php.